@@ -173,7 +173,9 @@ - (void)updateItemImageWithURL:(CPListItem *)item imgUrl:(NSString *)imgUrlStrin
173173 if (data) {
174174 UIImage *image = [UIImage imageWithData: data];
175175 dispatch_async (dispatch_get_main_queue (), ^{
176- [item setImage: image];
176+ if (image) {
177+ [item setImage: image];
178+ }
177179 });
178180 } else {
179181 NSLog (@" Failed to load image from URL: %@ " , imgUrl);
@@ -193,7 +195,9 @@ - (void)updateListRowItemImageWithURL:(CPListImageRowItem *)item imgUrl:(NSStrin
193195 NSMutableArray * newImages = [item.gridImages mutableCopy ];
194196
195197 @try {
196- newImages[index] = image;
198+ if (image) {
199+ newImages[index] = image;
200+ }
197201 }
198202 @catch (NSException *exception) {
199203 // Best effort updating the array
@@ -293,7 +297,7 @@ - (void)updateListRowItemImageWithURL:(CPListImageRowItem *)item imgUrl:(NSStrin
293297 if (![RCTConvert BOOL: config[@" backButtonHidden" ]]) {
294298 if (@available (iOS 14.0 , *)) {
295299 CPBarButton *backButton = [[CPBarButton alloc ] initWithTitle: @" Back" handler: ^(CPBarButton * _Nonnull barButton) {
296- if (hasListeners) {
300+ if (self-> hasListeners ) {
297301 [self sendEventWithName: @" backButtonPressed" body: @{@" templateId" :templateId}];
298302 }
299303 [self popTemplate: false ];
@@ -676,9 +680,11 @@ - (void)updateListRowItemImageWithURL:(CPListImageRowItem *)item imgUrl:(NSStrin
676680 CPTemplate *template = [store findTemplateById: templateId];
677681 if (template) {
678682 CPListTemplate *listTemplate = (CPListTemplate*) template;
679- [listTemplate updateSections: [self parseSections: sections templateId: templateId]];
683+ NSArray *parsedSections = [self parseSections: sections templateId: templateId];
684+
685+ [listTemplate updateSections: parsedSections];
680686 } else {
681- NSLog (@" Failed to find template %@ " , template );
687+ NSLog (@" Failed to find template %@ " , templateId );
682688 }
683689}
684690
@@ -1243,7 +1249,9 @@ - (void) applyConfigForMapTemplate:(CPMapTemplate*)mapTemplate templateId:(NSStr
12431249
12441250 for (NSObject *imageObj in slicedArray){
12451251 UIImage *_image = [RCTConvert UIImage: imageObj];
1246- [_images addObject: _image];
1252+ if (_image) {
1253+ [_images addObject: _image];
1254+ }
12471255 }
12481256 }
12491257 if (@available (iOS 14.0 , *)) {
0 commit comments