From 4f66c84d852d36e8af6d176076b15679d60ced0a Mon Sep 17 00:00:00 2001 From: adamburnett Date: Tue, 17 Jul 2018 09:53:37 -0600 Subject: [PATCH] Added null and path key check on addCompleteDownload method --- android/src/main/java/com/RNFetchBlob/RNFetchBlob.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java b/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java index b6cf7013e..ac9ce5669 100644 --- a/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java +++ b/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java @@ -372,6 +372,11 @@ public void getContentIntent(String mime, Promise promise) { @ReactMethod public void addCompleteDownload (ReadableMap config, Promise promise) { DownloadManager dm = (DownloadManager) RCTContext.getSystemService(RCTContext.DOWNLOAD_SERVICE); + if (config == null || !config.hasKey("path")) + { + promise.reject("EINVAL", "RNFetchblob.addCompleteDownload config or path missing."); + return; + } String path = RNFetchBlobFS.normalizePath(config.getString("path")); if(path == null) { promise.reject("EINVAL", "RNFetchblob.addCompleteDownload can not resolve URI:" + config.getString("path"));