Skip to content

Commit

Permalink
[Expert filter] NPE when unwrap no provided value for boolean criteria (
Browse files Browse the repository at this point in the history
  • Loading branch information
thangqp authored Jul 3, 2024
1 parent e49183a commit 8824181
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.gridsuite.filter.utils.expertfilter.DataType;

import java.util.Map;
import java.util.Optional;
import java.util.UUID;

import static org.gridsuite.filter.utils.expertfilter.ExpertFilterUtils.getFieldValue;
Expand Down Expand Up @@ -53,7 +54,7 @@ public boolean evaluateRule(Identifiable<?> identifiable, FilterLoader filterLoa
return this.getOperator() == NOT_EXISTS;
}
boolean identifiableValue = Boolean.parseBoolean(fieldValue);
Boolean filterValue = this.getValue();
boolean filterValue = Optional.ofNullable(this.getValue()).orElse(false);
return switch (this.getOperator()) {
case EQUALS -> identifiableValue == filterValue;
case NOT_EQUALS -> identifiableValue != filterValue;
Expand Down

0 comments on commit 8824181

Please sign in to comment.