浏览代码

Merge pull request #507 from joltup/exists-path-null-check

added null check to path before creating a File
Travis Nuttall 4 年前
父节点
当前提交
d35f806ced
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 8 次插入3 次删除
  1. 8
    3
      android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java

+ 8
- 3
android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java 查看文件

@@ -666,9 +666,14 @@ class RNFetchBlobFS {
666 666
         }
667 667
         else {
668 668
             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
+            }
672 677
         }
673 678
     }
674 679