intercom-cordova
intercom-cordova copied to clipboard
Handle nil initial message in presentMessageComposer
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.