Skip to content

Commit 60bedcb

Browse files
authored
Fix handling null image values in fcm_options (#11430) (#11431)
1 parent 26c5a71 commit 60bedcb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

FirebaseMessaging/Sources/FIRMessagingExtensionHelper.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ - (void)populateNotificationContent:(UNMutableNotificationContent *)content
112112

113113
// The `userInfo` property isn't available on newer versions of tvOS.
114114
#if TARGET_OS_IOS || TARGET_OS_OSX || TARGET_OS_WATCH
115-
NSString *currentImageURL = content.userInfo[kPayloadOptionsName][kPayloadOptionsImageURLName];
116-
if (!currentImageURL) {
115+
NSObject *currentImageURL = content.userInfo[kPayloadOptionsName][kPayloadOptionsImageURLName];
116+
if (!currentImageURL || currentImageURL == [NSNull null]) {
117117
[self deliverNotification];
118118
return;
119119
}
120-
NSURL *attachmentURL = [NSURL URLWithString:currentImageURL];
120+
NSURL *attachmentURL = [NSURL URLWithString:(NSString *)currentImageURL];
121121
if (attachmentURL) {
122122
[self loadAttachmentForURL:attachmentURL
123123
completionHandler:^(UNNotificationAttachment *attachment) {

0 commit comments

Comments
 (0)