Skip to content

Commit 4800935

Browse files
author
adamburnett
committed
Added check for failing to create the output directory
1 parent 5837361 commit 4800935

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,11 @@ static void mv(String path, String dest, Callback callback) {
604604
File dir = new File(dest);
605605
if (!dir.exists())
606606
{
607-
dir.mkdirs();
607+
if (!dir.mkdirs())
608+
{
609+
callback.invoke("Output directory creation failed.");
610+
return;
611+
}
608612
}
609613

610614
try {
@@ -622,7 +626,7 @@ static void mv(String path, String dest, Callback callback) {
622626

623627
src.delete(); //remove original file
624628
} catch (FileNotFoundException exception) {
625-
callback.invoke(exception.toString());
629+
callback.invoke("Source file not found.");
626630
return;
627631
} catch (Exception e) {
628632
callback.invoke(e.toString());

0 commit comments

Comments
 (0)