From 0fdf268ba8a8cd1cc22ad6f9648bf887cea3f7db Mon Sep 17 00:00:00 2001 From: Ben Roth Date: Thu, 14 Sep 2017 10:31:00 -0700 Subject: [PATCH] Avoid trying to load photo library assets with nil image url --- Libraries/CameraRoll/RCTPhotoLibraryImageLoader.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Libraries/CameraRoll/RCTPhotoLibraryImageLoader.m b/Libraries/CameraRoll/RCTPhotoLibraryImageLoader.m index b99ac934fedc15..0c2adb7f5206df 100644 --- a/Libraries/CameraRoll/RCTPhotoLibraryImageLoader.m +++ b/Libraries/CameraRoll/RCTPhotoLibraryImageLoader.m @@ -44,7 +44,10 @@ - (RCTImageLoaderCancellationBlock)loadImageForURL:(NSURL *)imageURL // form of an, NSURL which is what assets-library uses. NSString *assetID = @""; PHFetchResult *results; - if ([imageURL.scheme caseInsensitiveCompare:@"assets-library"] == NSOrderedSame) { + if (!imageURL) { + completionHandler(RCTErrorWithMessage(@"Cannot load a photo library asset with no URL"), nil); + return ^{}; + } else if ([imageURL.scheme caseInsensitiveCompare:@"assets-library"] == NSOrderedSame) { assetID = [imageURL absoluteString]; results = [PHAsset fetchAssetsWithALAssetURLs:@[imageURL] options:nil]; } else {