Fix crash in RCTImagePicker on iOS

Summary:
@public
Apparently if you select images really quickly, the app will crash.

Reviewed By: shergin

Differential Revision: D8796730

fbshipit-source-id: 81a652d9c8997ee9e83bbee3378954a6718a9b5d
This commit is contained in:
Mehdi Mulani 2018-07-12 10:30:27 -07:00 committed by Facebook Github Bot
parent 7eb419d4bf
commit 934c50fbe0
1 changed files with 5 additions and 0 deletions

View File

@ -153,6 +153,11 @@ didFinishPickingMediaWithInfo:(NSDictionary<NSString *, id> *)info
- (void)_dismissPicker:(UIImagePickerController *)picker args:(NSArray *)args
{
NSUInteger index = [_pickers indexOfObject:picker];
if (index == NSNotFound) {
// This happens if the user selects multiple items in succession.
return;
}
RCTResponseSenderBlock successCallback = _pickerCallbacks[index];
RCTResponseSenderBlock cancelCallback = _pickerCancelCallbacks[index];