Skip to content

Commit e638900

Browse files
authored
crash fix (#11873)
1 parent 0e7e4f9 commit e638900

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

FirebaseABTesting/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Unreleased
2+
- [fixed] Fix crash caused by empty experiment payload.
3+
14
# 10.14.0
25
- [fixed] Fix crash caused by mutating array during iteration. (#11669)
36

FirebaseABTesting/Sources/ABTConditionalUserPropertyController.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ - (void)setExperimentWithOrigin:(NSString *)origin
8787
return;
8888
}
8989

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

0 commit comments

Comments
 (0)