Skip to content

Commit d35f806

Browse files
authored
Merge pull request #507 from joltup/exists-path-null-check
added null check to path before creating a File
2 parents ffc372e + 2d66cbf commit d35f806

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -666,9 +666,14 @@ static void exists(String path, Callback callback) {
666666
}
667667
else {
668668
path = normalizePath(path);
669-
boolean exist = new File(path).exists();
670-
boolean isDir = new File(path).isDirectory();
671-
callback.invoke(exist, isDir);
669+
if (path != null) {
670+
boolean exist = new File(path).exists();
671+
boolean isDir = new File(path).isDirectory();
672+
callback.invoke(exist, isDir);
673+
}
674+
else {
675+
callback.invoke(false, false);
676+
}
672677
}
673678
}
674679

0 commit comments

Comments
 (0)