[ 
https://issues.apache.org/jira/browse/CB-6897?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Amit Gupta updated CB-6897:
---------------------------

    Summary: nil callbackId in isValidCallbackId() causes regex match to throw 
exception  (was: nil callbackId causes regex match to throw exception)

> nil callbackId in isValidCallbackId() causes regex match to throw exception
> ---------------------------------------------------------------------------
>
>                 Key: CB-6897
>                 URL: https://issues.apache.org/jira/browse/CB-6897
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 3.4.0
>         Environment: Mac OSX, XCode  5.1.1.  iOS 6.1 on iphone. cordova cli.
>            Reporter: Amit Gupta
>
> 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;
> }
> /// ERROR THROW:
> *** 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 PushPlugin:
> (void)successWithMessage:(NSString *)message
> {
>     CDVPluginResult *commandResult = [CDVPluginResult 
> resultWithStatus:CDVCommandStatus_OK messageAsString:message];
>     
>     [self.commandDelegate sendPluginResult:commandResult 
> callbackId:self.callbackId];
> }



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to