From 34e27bf0e5bbbb481f8c72fec1e5baa78e6d7134 Mon Sep 17 00:00:00 2001 From: Jake Brown Date: Mon, 6 Dec 2021 14:20:56 -0500 Subject: [PATCH] Add null check to flagKey when creating OptimizelyDecisionContext. --- .../main/java/com/optimizely/ab/OptimizelyDecisionContext.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core-api/src/main/java/com/optimizely/ab/OptimizelyDecisionContext.java b/core-api/src/main/java/com/optimizely/ab/OptimizelyDecisionContext.java index 4c4159301..3663f769d 100644 --- a/core-api/src/main/java/com/optimizely/ab/OptimizelyDecisionContext.java +++ b/core-api/src/main/java/com/optimizely/ab/OptimizelyDecisionContext.java @@ -27,6 +27,7 @@ public class OptimizelyDecisionContext { private String ruleKey; public OptimizelyDecisionContext(@Nonnull String flagKey, @Nullable String ruleKey) { + if (flagKey == null) throw new NullPointerException("FlagKey must not be null, please provide a valid input."); this.flagKey = flagKey; this.ruleKey = ruleKey; }