Przeglądaj źródła

Added null and path key check on addCompleteDownload method

adamburnett 5 lat temu
rodzic
commit
4f66c84d85

+ 5
- 0
android/src/main/java/com/RNFetchBlob/RNFetchBlob.java Wyświetl plik

@@ -372,6 +372,11 @@ public class RNFetchBlob extends ReactContextBaseJavaModule {
372 372
     @ReactMethod
373 373
     public void addCompleteDownload (ReadableMap config, Promise promise) {
374 374
         DownloadManager dm = (DownloadManager) RCTContext.getSystemService(RCTContext.DOWNLOAD_SERVICE);
375
+        if (config == null || !config.hasKey("path"))
376
+        {
377
+            promise.reject("EINVAL", "RNFetchblob.addCompleteDownload config or path missing.");
378
+            return;
379
+        }
375 380
         String path = RNFetchBlobFS.normalizePath(config.getString("path"));
376 381
         if(path == null) {
377 382
             promise.reject("EINVAL", "RNFetchblob.addCompleteDownload can not resolve URI:" + config.getString("path"));