Skip to content

Commit 934c50f

Browse files
Mehdi Mulanifacebook-github-bot
Mehdi Mulani
authored andcommitted
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
1 parent 7eb419d commit 934c50f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Libraries/CameraRoll/RCTImagePickerManager.m

+5
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ - (void)_presentPicker:(UIImagePickerController *)imagePicker
153153
- (void)_dismissPicker:(UIImagePickerController *)picker args:(NSArray *)args
154154
{
155155
NSUInteger index = [_pickers indexOfObject:picker];
156+
if (index == NSNotFound) {
157+
// This happens if the user selects multiple items in succession.
158+
return;
159+
}
160+
156161
RCTResponseSenderBlock successCallback = _pickerCallbacks[index];
157162
RCTResponseSenderBlock cancelCallback = _pickerCancelCallbacks[index];
158163

0 commit comments

Comments
 (0)