Skip to content

Commit 1ffe622

Browse files
committed
fix empty arrays in excluded
1 parent bca3958 commit 1ffe622

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

client/src/main/java/io/split/client/utils/RuleBasedSegmentProcessor.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ public static RuleBasedSegmentsToUpdate processRuleBasedSegmentChanges(RuleBased
2222
List<String> toRemove = new ArrayList<>();
2323
Set<String> segments = new HashSet<>();
2424
for (RuleBasedSegment ruleBasedSegment : ruleBasedSegments) {
25-
if (ruleBasedSegment.excluded == null)
26-
{
27-
ruleBasedSegment.excluded = createEmptyExcluded();
28-
}
25+
ruleBasedSegment.excluded = checkExcluded(ruleBasedSegment.excluded);
2926
if (ruleBasedSegment.status != Status.ACTIVE) {
3027
// archive.
3128
toRemove.add(ruleBasedSegment.name);
@@ -49,4 +46,16 @@ private static Excluded createEmptyExcluded() {
4946
return excluded;
5047
}
5148

49+
private static Excluded checkExcluded(Excluded excluded) {
50+
if (excluded == null) {
51+
excluded = createEmptyExcluded();
52+
}
53+
if (excluded.segments == null) {
54+
excluded.segments = new ArrayList<>();
55+
}
56+
if (excluded.keys == null) {
57+
excluded.keys = new ArrayList<>();
58+
}
59+
return excluded;
60+
}
5261
}

0 commit comments

Comments
 (0)