cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shazron Abdullah (JIRA)" <>
Subject [jira] [Commented] (CB-6897) nil callbackId in isValidCallbackId() causes regex match to throw exception
Date Wed, 27 Aug 2014 04:47:59 GMT


Shazron Abdullah commented on CB-6897:

The PR was closed but this issue is still open. The PR has the right idea, but the wrong return

> nil callbackId in isValidCallbackId() causes regex match to throw exception
> ---------------------------------------------------------------------------
>                 Key: CB-6897
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 3.5.0
>         Environment: Mac OSX, XCode  5.1.1.  iOS 6.1 on iphone. cordova cli.
>            Reporter: Amit Gupta
> (to determine i'm using cordova lib 3.5.0, I ran <project_home>/platforms/ios/cordova/version)
> An exception is thrown at this line of code which causes my cordova app to stop. If I
comment out this line of code, my app seems to run fun.  The PushPlugin seems to pass in a
null callbackId to the isValidCallbackId.  maybe we should test the callbackId first to see
if it's null before trying the regex?  I'm pretty new to cordova, so please pardon my ignorance
if callbackId should never be nil..
> //File:  <project>/platforms/ios/CordovaLib/Classes/CDVCommandDelegateImpl.m
> // Function:  (BOOL)isValidCallbackId:(NSString *)callbackId
> if (([callbackId length] > 100) || [_callbackIdPattern firstMatchInString:callbackId
options:0 range:NSMakeRange(0, [callbackId length])]) {
>         return NO;
> }
> *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '***
-[NSRegularExpression enumerateMatchesInString:options:range:usingBlock:]: nil argument'
> *** First throw call stack:
> (0x189e6af50 0x1963741fc 0x189e6ae90 0x18a965060 0x18a964f44 0x1000ad758 0x1000ad8b8
0x1000b8c78 0x1000b8028 0x1000b6e74 0x189e6f700 0x189d88eec 0x189d8d744 0x1000bfbac 0x189e6d740
0x189d8d5dc 0x18d198cd0 0x18d199c3c 0x18e2a18f0 0x189e2ae90 0x189e2adf0 0x189e29014 0x189d69c20
0x18fa51c0c 0x18ce9afdc 0x1000b2efc 0x196967aa0)
> // MORE details.
> // The caller of the function that passes the null callbackId iseems to come from the
> (void)successWithMessage:(NSString *)message
> {
>     CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
>     [self.commandDelegate sendPluginResult:commandResult callbackId:self.callbackId];
> }

This message was sent by Atlassian JIRA

View raw message