diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2020-07-15 10:25:35 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2020-07-15 10:25:35 -0400 |
commit | cae8bfb78a8ed9528a99f857df732ce88db2a66f (patch) | |
tree | ac5535abf5809126f9069f2ec8a173bd50f639ad | |
parent | 280d05ca1d8c6fa41477d18984326639369b855c (diff) | |
download | sdl_ios-cae8bfb78a8ed9528a99f857df732ce88db2a66f.tar.gz |
Fix unknown RPC crash #1713bugfix/issue-1713-fix-crash-unknown-rpc
-rw-r--r-- | SmartDeviceLink/SDLLifecycleProtocolHandler.m | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/SmartDeviceLink/SDLLifecycleProtocolHandler.m b/SmartDeviceLink/SDLLifecycleProtocolHandler.m index 648c259ec..d517e89ee 100644 --- a/SmartDeviceLink/SDLLifecycleProtocolHandler.m +++ b/SmartDeviceLink/SDLLifecycleProtocolHandler.m @@ -142,6 +142,9 @@ NS_ASSUME_NONNULL_BEGIN NSString *functionClassName = [NSString stringWithFormat:@"SDL%@", fullName]; SDLRPCMessage *newMessage = [[NSClassFromString(functionClassName) alloc] initWithDictionary:rpcMessageAsDictionary]; + // If we were unable to create the message, it's an unknown type; discard it + if (newMessage == nil) { return; } + // Adapt the incoming message then call the callback NSArray<SDLRPCMessage *> *adaptedMessages = [SDLLifecycleRPCAdapter adaptRPC:newMessage direction:SDLRPCDirectionIncoming]; for (SDLRPCMessage *message in adaptedMessages) { |