react-native/Libraries/CameraRoll
Ben Roth 7fab093fc8 Fix crash when trying to load photo library assets with nil image url
Summary:
This avoids a crash when we try to load a PHAsset with nil image url. Specifically, the following condition evaluates to true when `imageURL` is nil:

```objc
if ([imageURL.scheme caseInsensitiveCompare:@"assets-library"] == NSOrderedSame) {
    assetID = [imageURL absoluteString];
    results = [PHAsset fetchAssetsWithALAssetURLs:@[imageURL] options:nil];
}
```

The crash will be "attempt to insert nil object from objects[0]" when we build the `@[imageURL]` array literal.

We've seen this emerge as a very common crash among Expo users, so I wanted to at least provide a clear error message instead of terminating the app.

Load an image from the photo library with a nil request url.
Closes https://github.com/facebook/react-native/pull/15952

Differential Revision: D5835219

Pulled By: ericnakagawa

fbshipit-source-id: 7be00a15e674a0905cf5c27c526ce9085d1b308f
2017-09-14 12:02:27 -07:00
..
RCTCameraRoll.xcodeproj Standardize project indentation settings on 2 spaces 2017-07-31 05:20:03 -07:00
CameraRoll.js Flow type: saveToCameraRoll returns a string 2017-09-12 10:01:11 -07:00
ImagePickerIOS.js fix camera roll lint warnings 2015-11-30 16:25:41 -08:00
RCTAssetsLibraryRequestHandler.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTAssetsLibraryRequestHandler.m CameraRoll: Use C atomic instead of OSAtomic 2017-07-31 03:35:28 -07:00
RCTCameraRollManager.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTCameraRollManager.m Mark non-extern strings static 2017-07-25 04:49:46 -07:00
RCTImagePickerManager.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTImagePickerManager.m remove unused includes in fbobjc/Libraries 2017-02-19 18:33:49 -08:00
RCTPhotoLibraryImageLoader.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTPhotoLibraryImageLoader.m Fix crash when trying to load photo library assets with nil image url 2017-09-14 12:02:27 -07:00