summaryrefslogtreecommitdiff
path: root/SmartDeviceLink
diff options
context:
space:
mode:
authorMuller, Alexander (A.) <amulle19@ford.com>2017-01-18 20:25:54 -0800
committerMuller, Alexander (A.) <amulle19@ford.com>2017-01-18 20:25:54 -0800
commitfcfba928fc4334dc81bf551548141211806552a5 (patch)
tree858d34e54f26ab6d18b80f7817a8ee74f80fb135 /SmartDeviceLink
parentd102326380d144e1c35e6f0ae44be2e9ab387784 (diff)
downloadsdl_ios-fcfba928fc4334dc81bf551548141211806552a5.tar.gz
Added check for nil request in sending.
Diffstat (limited to 'SmartDeviceLink')
-rw-r--r--SmartDeviceLink/SDLLifecycleManager.m9
1 files changed, 9 insertions, 0 deletions
diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m
index 6c761606d..d13a27050 100644
--- a/SmartDeviceLink/SDLLifecycleManager.m
+++ b/SmartDeviceLink/SDLLifecycleManager.m
@@ -367,6 +367,15 @@ 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
+ // If, for some reason, the request is nil we should error out.
+ if (!request) {
+ [SDLDebugTool logInfo:@"Attempting to send a nil request, request not sent."];
+ if (handler) {
+ handler(nil, nil, [NSError sdl_lifecycle_rpcErrorWithDescription:@"Nil Request" andReason:@"Request must not be nil"]);
+ }
+ return;
+ }
+
// Add a correlation ID to the request
NSNumber *corrID = [self sdl_getNextCorrelationId];
request.correlationID = corrID;