Skip to content

Commit 33ce2c2

Browse files
authored
[#8482] Fixed Crash Caused by Invalid IAM Image URL (#8483)
* Fixed a bug where an invalid image URL string in an in-app message crashed the client app * A URL string is considered invalid if the `[NSURL URLWithString:]` method produces `nil`
1 parent 853fdf9 commit 33ce2c2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayExecutor.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,14 @@ - (void)displayForMessage:(FIRIAMMessageDefinition *)message
668668
imageData:imageData
669669
landscapeImageData:landscapeImageData
670670
triggerType:triggerType];
671+
672+
// A final `nil`-check, performed to avoid crashing the client app.
673+
if (!displayMessage) {
674+
FIRLogDebug(kFIRLoggerInAppMessaging, @"I-IAM400043",
675+
@"Failed to construct a non-nil display message.");
676+
return;
677+
}
678+
671679
[self.messageDisplayComponent displayMessage:displayMessage displayDelegate:self];
672680
}];
673681
}

0 commit comments

Comments
 (0)