Przeglądaj źródła

[#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`
Yakov Manshin 4 lat temu
rodzic
commit
33ce2c2da4

+ 8 - 0
FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayExecutor.m

@@ -668,6 +668,14 @@
                                             imageData:imageData
                                    landscapeImageData:landscapeImageData
                                           triggerType:triggerType];
+
+        // A final `nil`-check, performed to avoid crashing the client app.
+        if (!displayMessage) {
+          FIRLogDebug(kFIRLoggerInAppMessaging, @"I-IAM400043",
+                      @"Failed to construct a non-nil display message.");
+          return;
+        }
+
         [self.messageDisplayComponent displayMessage:displayMessage displayDelegate:self];
       }];
 }