From 96a692695cbafca282df084889fcd42e10a3a091 Mon Sep 17 00:00:00 2001 From: PiwEL Date: Thu, 20 Nov 2025 17:46:48 +0100 Subject: [PATCH] Handle nil initial message in presentMessageComposer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi Intercom Cordova team, We’re seeing a reproducible crash on iOS whenever presentMessageComposer (or the deprecated displayMessageComposer) is invoked without an initial message. The bridge always indexes into command.arguments[0], but when Cordova sends an empty arguments array the call throws NSRangeException: Fatal Exception: NSRangeException -[IntercomBridge presentMessageComposer:] + IntercomBridge.m:175 -[NSArray objectAtIndexedSubscript:] Android avoids this by reading args.optString(0), but the iOS bridge doesn’t guard against command.arguments.count == 0 or an NSNull. This mirrors the Android behavior and prevents the crash for callers that don’t supply an initial message. --- intercom-plugin/src/ios/IntercomBridge.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/intercom-plugin/src/ios/IntercomBridge.m b/intercom-plugin/src/ios/IntercomBridge.m index 0a6c2d8..fc2f1bc 100644 --- a/intercom-plugin/src/ios/IntercomBridge.m +++ b/intercom-plugin/src/ios/IntercomBridge.m @@ -172,7 +172,10 @@ - (void)presentContent:(CDVInvokedUrlCommand*)command { } - (void)presentMessageComposer:(CDVInvokedUrlCommand*)command { - NSString *initialMessage = command.arguments[0]; + NSString *initialMessage = nil; + if (command.arguments.count > 0 && command.arguments[0] != [NSNull null]) { + initialMessage = command.arguments[0]; + } [Intercom presentMessageComposer:initialMessage]; [self sendSuccess:command]; }