Skip to content

Commit

Permalink
open-feature#128 - Fix NPE when anonymous field is missing
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Poignant <thomas.poignant@gofeatureflag.org>
  • Loading branch information
thomaspoignant committed Nov 16, 2022
1 parent b0389da commit 610f8ce
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ public static GoFeatureFlagUser fromEvaluationContext(EvaluationContext ctx) {
if (key == null || "".equals(key)) {
throw new InvalidTargetingKey();
}

Value anonymousValue = ctx.getValue(anonymousFieldName);
if (anonymousValue == null) {
anonymousValue = new Value(Boolean.FALSE);
}
boolean anonymous = anonymousValue.asBoolean();
Map<String, Object> custom = new HashMap<>(ctx.asObjectMap());
if (ctx.getValue(anonymousFieldName) != null) {
Expand Down

0 comments on commit 610f8ce

Please sign in to comment.