diff options
author | Brett W <geekman3454@protonmail.com> | 2017-08-04 08:38:14 -0400 |
---|---|---|
committer | Brett W <geekman3454@protonmail.com> | 2017-08-04 08:38:14 -0400 |
commit | 7a8b1d2b8deb9ff1076a183217e9ba31630aaa7b (patch) | |
tree | 13618ec3e5cf336d19a189e5ed5e17f5da82acfc | |
parent | f8905515bb1f8ff268074616ec0a1a1be4d61dd7 (diff) | |
download | sdl_ios-7a8b1d2b8deb9ff1076a183217e9ba31630aaa7b.tar.gz |
fixed getters
-rw-r--r-- | SmartDeviceLink/SDLMetadataStruct.m | 53 |
1 files changed, 49 insertions, 4 deletions
diff --git a/SmartDeviceLink/SDLMetadataStruct.m b/SmartDeviceLink/SDLMetadataStruct.m index abb2cc367..7830d20c0 100644 --- a/SmartDeviceLink/SDLMetadataStruct.m +++ b/SmartDeviceLink/SDLMetadataStruct.m @@ -59,9 +59,21 @@ } - (NSMutableArray<SDLTextFieldType *> *)mainField1 { - return [store objectForKey:NAMES_mainField1Type]; + NSMutableArray *array = [store objectForKey:NAMES_mainField1Type]; + if ([array isEqual:[NSNull null]]) { + return [NSMutableArray array]; + } else if (array.count < 1 || [array.firstObject isKindOfClass:SDLTextFieldType.class]) { + return array; + } else { + NSMutableArray *newList = [NSMutableArray arrayWithCapacity:[array count]]; + for (SDLTextFieldType *type in array) { + [newList addObject:type]; + } + return newList; + } } + - (void)setMainField2:(NSMutableArray<SDLTextFieldType *> *)mainField2 { if (mainField2 != nil) { [store setObject:mainField2 forKey:NAMES_mainField2Type]; @@ -71,7 +83,18 @@ } - (NSMutableArray<SDLTextFieldType *> *)mainField2 { - return [store objectForKey:NAMES_mainField2Type]; + NSMutableArray *array = [store objectForKey:NAMES_mainField2Type]; + if ([array isEqual:[NSNull null]]) { + return [NSMutableArray array]; + } else if (array.count < 1 || [array.firstObject isKindOfClass:SDLTextFieldType.class]) { + return array; + } else { + NSMutableArray *newList = [NSMutableArray arrayWithCapacity:[array count]]; + for (SDLTextFieldType *type in array) { + [newList addObject:type]; + } + return newList; + } } - (void)setMainField3:(NSMutableArray<SDLTextFieldType *> *)mainField3 { @@ -83,7 +106,18 @@ } - (NSMutableArray<SDLTextFieldType *> *)mainField3 { - return [store objectForKey:NAMES_mainField3Type]; + NSMutableArray *array = [store objectForKey:NAMES_mainField3Type]; + if ([array isEqual:[NSNull null]]) { + return [NSMutableArray array]; + } else if (array.count < 1 || [array.firstObject isKindOfClass:SDLTextFieldType.class]) { + return array; + } else { + NSMutableArray *newList = [NSMutableArray arrayWithCapacity:[array count]]; + for (SDLTextFieldType *type in array) { + [newList addObject:type]; + } + return newList; + } } - (void)setMainField4:(NSMutableArray<SDLTextFieldType *> *)mainField4 { @@ -95,7 +129,18 @@ } - (NSMutableArray<SDLTextFieldType *> *)mainField4 { - return [store objectForKey:NAMES_mainField4Type]; + NSMutableArray *array = [store objectForKey:NAMES_mainField4Type]; + if ([array isEqual:[NSNull null]]) { + return [NSMutableArray array]; + } else if (array.count < 1 || [array.firstObject isKindOfClass:SDLTextFieldType.class]) { + return array; + } else { + NSMutableArray *newList = [NSMutableArray arrayWithCapacity:[array count]]; + for (SDLTextFieldType *type in array) { + [newList addObject:type]; + } + return newList; + } } @end |