Skip to content

Commit

Permalink
avniproject/avni-webapp#1257 | Fix potential NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
1t5j0y committed Oct 14, 2024
1 parent 930a9f0 commit 86e499c
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static org.avni.server.application.FormElement.PLACEHOLDER_CONCEPT_NAME;
import static org.avni.server.application.FormElement.PLACEHOLDER_CONCEPT_UUID;
import static org.avni.server.domain.ConceptDataType.multiSelectTypes;
import static org.springframework.util.ObjectUtils.nullSafeEquals;

@Service
public class FormService implements NonScopeAwareService {
Expand Down Expand Up @@ -173,7 +174,7 @@ public void validateForm(FormContract formContract) throws InvalidObjectExceptio
if (formElement.getConcept().isQuestionGroup()) {
FormElement existingFormElement = formElementRepository.findByUuid(formElement.getUuid());
if (existingFormElement != null) {
if (!existingFormElement.getKeyValues().get(KeyType.repeatable).equals(formElement.getKeyValues().get(KeyType.repeatable))) {
if (!nullSafeEquals(existingFormElement.getKeyValues().get(KeyType.repeatable), formElement.getKeyValues().get(KeyType.repeatable))) {
throw new InvalidObjectException(String.format("Cannot change from Repeatable to Non Repeatable or vice versa for form element: %s", existingFormElement.getName()));
}
}
Expand Down

0 comments on commit 86e499c

Please sign in to comment.