Skip to content

Commit

Permalink
Avoid trying to load photo library assets with nil image url
Browse files Browse the repository at this point in the history
  • Loading branch information
terribleben committed Sep 14, 2017
1 parent f568090 commit 0fdf268
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Libraries/CameraRoll/RCTPhotoLibraryImageLoader.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 0fdf268

Please sign in to comment.