Skip to content

Commit 728bd81

Browse files
authored
Merge pull request #278 from bernhardoj/fix/failed-to-build-unique-file
Android - Fix failed to build unique file crash
2 parents 95b4163 + 56a715d commit 728bd81

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilMediaCollection.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,12 @@ public static Uri createNewMediaFile(FileDescription file, MediaType mt, ReactAp
9595

9696
Uri mediauri = getMediaUri(mt);
9797

98-
// Keeps a handle to the new file's URI in case we need to modify it later.
99-
return resolver.insert(mediauri, fileDetails);
98+
try {
99+
// Keeps a handle to the new file's URI in case we need to modify it later.
100+
return resolver.insert(mediauri, fileDetails);
101+
} catch (Exception e) {
102+
return null;
103+
}
100104
} else {
101105
File f = new File(relativePath + file.getFullPath());
102106
if (true) {

0 commit comments

Comments
 (0)