diff --git a/ios/RNDocumentPicker/RNDocumentPicker.m b/ios/RNDocumentPicker/RNDocumentPicker.m index 2b44a039..5bc80c29 100644 --- a/ios/RNDocumentPicker/RNDocumentPicker.m +++ b/ios/RNDocumentPicker/RNDocumentPicker.m @@ -182,10 +182,16 @@ - (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocum if (controller.documentPickerMode == UIDocumentPickerModeImport) { RCTPromiseResolveBlock resolve = [composeResolvers lastObject]; RCTPromiseRejectBlock reject = [composeRejecters lastObject]; + + if (resolve == nil) { + return; + } + [composeResolvers removeLastObject]; [composeRejecters removeLastObject]; - + NSMutableArray *results = [NSMutableArray array]; + for (id url in urls) { NSError *error; NSMutableDictionary* result = [self getMetadataForUrl:url error:&error];