diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2017-01-19 15:25:41 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-19 15:25:41 -0500 |
commit | 4b2db7e76ea741e168ce092cdc686968f15c215e (patch) | |
tree | 1da413042c5876f66028f9bf19301c20cbe96b0e /SmartDeviceLink | |
parent | 39d3b1bd1eddaad338aa93556a5846daa31e6960 (diff) | |
parent | 6d085f3d5a25ca5d774b56ff9262855983cb9215 (diff) | |
download | sdl_ios-4b2db7e76ea741e168ce092cdc686968f15c215e.tar.gz |
Merge pull request #500 from smartdevicelink/hotfix/issue_499
Fix Sending Nil Request Causing Crash.
Diffstat (limited to 'SmartDeviceLink')
-rw-r--r-- | SmartDeviceLink/SDLLifecycleManager.m | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m index 6c761606d..19d9717d6 100644 --- a/SmartDeviceLink/SDLLifecycleManager.m +++ b/SmartDeviceLink/SDLLifecycleManager.m @@ -367,6 +367,16 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; - (void)sdl_sendRequest:(SDLRPCRequest *)request withResponseHandler:(nullable SDLResponseHandler)handler { // We will allow things to be sent in a "SDLLifeCycleStateTransportConnected" state in the private method, but block it in the public method sendRequest:withCompletionHandler: so that the lifecycle manager can complete its setup without being bothered by developer error + NSParameterAssert(request != nil); + + // If, for some reason, the request is nil we should error out. + if (!request) { + if (handler) { + handler(nil, nil, [NSError sdl_lifecycle_rpcErrorWithDescription:@"Nil Request Sent" andReason:@"A nil RPC request was passed and cannot be sent."]); + } + return; + } + // Add a correlation ID to the request NSNumber *corrID = [self sdl_getNextCorrelationId]; request.correlationID = corrID; |