Procházet zdrojové kódy

Merge pull request #121 from ihavenoface5/ReadableMapNullCheck

Added null and path key check on addCompleteDownload method
Travis Nuttall před 5 roky
rodič
revize
ebc320f167
No account linked to committer's email address

+ 5
- 0
android/src/main/java/com/RNFetchBlob/RNFetchBlob.java Zobrazit soubor

@@ -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"));