Skip to content

Commit ed5e516

Browse files
committed
improve clarity for IN
1 parent 3a05d8b commit ed5e516

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main/java/com/flagsmith/flagengine/segments/SegmentEvaluator.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ private static Boolean contextMatchesCondition(
8383

8484
switch (operator) {
8585
case IN:
86+
if (contextValue == null || contextValue instanceof Boolean) {
87+
return false;
88+
}
89+
8690
List<String> conditionList = new ArrayList<>();
8791

8892
if (conditionValue instanceof List) {
@@ -102,11 +106,7 @@ private static Boolean contextMatchesCondition(
102106
}
103107
}
104108

105-
if (!(contextValue instanceof Boolean) && contextValue != null) {
106-
contextValue = String.valueOf(contextValue);
107-
}
108-
109-
return conditionList.contains(contextValue);
109+
return conditionList.contains(String.valueOf(contextValue));
110110

111111
case PERCENTAGE_SPLIT:
112112
String key;

0 commit comments

Comments
 (0)