Skip to content

Commit 745db03

Browse files
chore: meta should be null if key is not parsable
1 parent 5298fad commit 745db03

File tree

1 file changed

+6
-5
lines changed
  • lib/sdk/server-ai/src/main/java/com/launchdarkly/sdk/server/ai

1 file changed

+6
-5
lines changed

lib/sdk/server-ai/src/main/java/com/launchdarkly/sdk/server/ai/LDAiClient.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,16 @@ protected AiConfig parseAiConfig(LDValue value, String key) {
7575
// expecting, which is good
7676
enabled = valueMeta.get("enabled").booleanValue();
7777

78-
String variationKey = null;
78+
Meta meta = null;
79+
7980
if (checkValueWithFailureLogging(valueMeta.get("variationKey"), LDValueType.STRING, logger,
8081
"variationKey should be a string")) {
81-
variationKey = valueMeta.get("variationKey").stringValue();
82-
}
83-
// Create Meta using constructor
84-
Meta meta = new Meta(
82+
String variationKey = valueMeta.get("variationKey").stringValue();
83+
84+
meta = new Meta(
8585
variationKey,
8686
Optional.of(valueMeta.get("version").intValue()));
87+
}
8788

8889
// Convert the optional model from an JSON object of with parameters and custom
8990
// into Model

0 commit comments

Comments
 (0)