Eldhose M Babu 2 years ago
parent
commit
e6389004bf

+ 3 - 0
FirebaseABTesting/CHANGELOG.md

@@ -1,3 +1,6 @@
+# Unreleased
+- [fixed] Fix crash caused by empty experiment payload.
+
 # 10.14.0
 - [fixed] Fix crash caused by mutating array during iteration. (#11669)
 

+ 7 - 0
FirebaseABTesting/Sources/ABTConditionalUserPropertyController.m

@@ -87,6 +87,13 @@
     return;
   }
 
+  if (payload.experimentId == nil) {
+    // When doing experiment test on devices, the payload could be empty. Returning here to prevent
+    // app crash.
+    FIRLogInfo(kFIRLoggerABTesting, @"I-ABT000020", @"Experiment Id in payload is empty.");
+    return;
+  }
+
   if (maxNumOfExperiments <= experiments.count) {
     ABTExperimentPayloadExperimentOverflowPolicy overflowPolicy =
         [self overflowPolicyWithPayload:payload originalPolicy:policy];