Ver código fonte

Add exception handling for #206

Ben Hsieh 8 anos atrás
pai
commit
f4a6b6c59b

+ 4
- 0
src/android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java Ver arquivo

@@ -572,6 +572,10 @@ public class RNFetchBlobFS {
572 572
             @Override
573 573
             protected Integer doInBackground(String ...args) {
574 574
                 WritableArray res = Arguments.createArray();
575
+                if(args[0] == null) {
576
+                    callback.invoke("lstat error: the path specified for lstat is either `null` or `undefined`.");
577
+                    return 0;
578
+                }
575 579
                 File src = new File(args[0]);
576 580
                 if(!src.exists()) {
577 581
                     callback.invoke("lstat error: failed to list path `" + args[0] + "` for it is not exist or it is not a folder");