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:
parent
7eb419d4bf
commit
934c50fbe0
|
@ -153,6 +153,11 @@ didFinishPickingMediaWithInfo:(NSDictionary<NSString *, id> *)info
|
||||||
- (void)_dismissPicker:(UIImagePickerController *)picker args:(NSArray *)args
|
- (void)_dismissPicker:(UIImagePickerController *)picker args:(NSArray *)args
|
||||||
{
|
{
|
||||||
NSUInteger index = [_pickers indexOfObject:picker];
|
NSUInteger index = [_pickers indexOfObject:picker];
|
||||||
|
if (index == NSNotFound) {
|
||||||
|
// This happens if the user selects multiple items in succession.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
RCTResponseSenderBlock successCallback = _pickerCallbacks[index];
|
RCTResponseSenderBlock successCallback = _pickerCallbacks[index];
|
||||||
RCTResponseSenderBlock cancelCallback = _pickerCancelCallbacks[index];
|
RCTResponseSenderBlock cancelCallback = _pickerCancelCallbacks[index];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue