handle crash when the imagesIdArray is nil/not an array/empty

This commit is contained in:
Ran Greenberg 2017-11-23 12:23:42 +02:00
parent 018d88002f
commit 7aa792020a

View File

@ -248,6 +248,11 @@ RCT_EXPORT_METHOD(resizeImage:(NSDictionary*)image
resolve:(RCTPromiseResolveBlock)resolve
reject:(__unused RCTPromiseRejectBlock)reject {
if (!imagesIdArray || ![imagesIdArray isKindOfClass:[NSArray class]] || imagesIdArray.count <= 0 ) {
resolve(@{@"images": @[]});
return;
}
NSMutableArray *assetsArray = [[NSMutableArray alloc] initWithArray:imagesIdArray];
PHImageRequestOptions *imageRequestOptions = [[PHImageRequestOptions alloc] init];