Skip to content

Commit

Permalink
Merge pull request #1709 from wordpress-mobile/fix/file-not-found-exc…
Browse files Browse the repository at this point in the history
…eption-media-iob-crash

Handle empty media selection for file not found case
  • Loading branch information
malinajirka authored Jan 7, 2020
2 parents 9e8196a + 9fe5d8c commit 884e9ab
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,12 @@ public void onUploadMediaFileSelected(List<RNMedia> mediaList) {
writableArray.pushMap(media.toMap());
}
jsCallback.invoke(writableArray);
} else {
} else if (!mediaList.isEmpty()) {
jsCallback.invoke(mediaList.get(0).toMap());
} else {
// if we have no media (e.g. when a content provider throws an exception during file copy), invoke
// the js callback with no arguments
jsCallback.invoke();
}
}

Expand Down

0 comments on commit 884e9ab

Please sign in to comment.