diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2018-01-29 15:56:42 -0500 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2018-01-29 15:56:42 -0500 |
commit | f623ee5ef89d905b58e0829555003cc6e5e2ab79 (patch) | |
tree | e1c2c00814f45bbc08bd55e45b4b17af747d6317 | |
parent | 882aa24b31f92119f600a8fdc0b50dca7dec1d71 (diff) | |
download | sdl_ios-f623ee5ef89d905b58e0829555003cc6e5e2ab79.tar.gz |
Fix #846
* Allow AddCommand initializer to create a command with a parent but no icon
-rw-r--r-- | SmartDeviceLink/SDLAddCommand.h | 2 | ||||
-rw-r--r-- | SmartDeviceLink/SDLAddCommand.m | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/SmartDeviceLink/SDLAddCommand.h b/SmartDeviceLink/SDLAddCommand.h index 509ea80fa..f4eed257e 100644 --- a/SmartDeviceLink/SDLAddCommand.h +++ b/SmartDeviceLink/SDLAddCommand.h @@ -51,7 +51,7 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithId:(UInt32)commandId vrCommands:(nullable NSArray<NSString *> *)vrCommands menuName:(NSString *)menuName handler:(SDLRPCCommandNotificationHandler)handler; -- (instancetype)initWithId:(UInt32)commandId vrCommands:(nullable NSArray<NSString *> *)vrCommands menuName:(NSString *)menuName parentId:(UInt32)parentId position:(UInt16)position iconValue:(NSString *)iconValue iconType:(SDLImageType)iconType handler:(nullable SDLRPCCommandNotificationHandler)handler; +- (instancetype)initWithId:(UInt32)commandId vrCommands:(nullable NSArray<NSString *> *)vrCommands menuName:(NSString *)menuName parentId:(UInt32)parentId position:(UInt16)position iconValue:(nullable NSString *)iconValue iconType:(nullable SDLImageType)iconType handler:(nullable SDLRPCCommandNotificationHandler)handler; /** * A handler that will let you know when the button you created is subscribed. diff --git a/SmartDeviceLink/SDLAddCommand.m b/SmartDeviceLink/SDLAddCommand.m index bfec12164..b97b0e402 100644 --- a/SmartDeviceLink/SDLAddCommand.m +++ b/SmartDeviceLink/SDLAddCommand.m @@ -54,7 +54,7 @@ NS_ASSUME_NONNULL_BEGIN return self; } -- (instancetype)initWithId:(UInt32)commandId vrCommands:(nullable NSArray<NSString *> *)vrCommands menuName:(NSString *)menuName parentId:(UInt32)parentId position:(UInt16)position iconValue:(NSString *)iconValue iconType:(SDLImageType)iconType handler:(nullable SDLRPCCommandNotificationHandler)handler { +- (instancetype)initWithId:(UInt32)commandId vrCommands:(nullable NSArray<NSString *> *)vrCommands menuName:(NSString *)menuName parentId:(UInt32)parentId position:(UInt16)position iconValue:(nullable NSString *)iconValue iconType:(nullable SDLImageType)iconType handler:(nullable SDLRPCCommandNotificationHandler)handler { self = [self initWithId:commandId vrCommands:vrCommands menuName:menuName handler:handler]; if (!self) { return nil; @@ -63,7 +63,9 @@ NS_ASSUME_NONNULL_BEGIN self.menuParams.parentID = @(parentId); self.menuParams.position = @(position); - self.cmdIcon = [[SDLImage alloc] initWithName:iconValue ofType:iconType]; + if (iconValue != nil && iconType != nil) { + self.cmdIcon = [[SDLImage alloc] initWithName:iconValue ofType:iconType]; + } return self; } |