Skip to content

Commit 56a715d

Browse files
committed
fix failed to build unique file crash
1 parent 1040174 commit 56a715d

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)