Skip to content

Commit ebc320f

Browse files
authored
Merge pull request joltup#121 from ihavenoface5/ReadableMapNullCheck
Added null and path key check on addCompleteDownload method
2 parents 41e1572 + 4f66c84 commit ebc320f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

android/src/main/java/com/RNFetchBlob/RNFetchBlob.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,11 @@ public void getContentIntent(String mime, Promise promise) {
372372
@ReactMethod
373373
public void addCompleteDownload (ReadableMap config, Promise promise) {
374374
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+
}
375380
String path = RNFetchBlobFS.normalizePath(config.getString("path"));
376381
if(path == null) {
377382
promise.reject("EINVAL", "RNFetchblob.addCompleteDownload can not resolve URI:" + config.getString("path"));

0 commit comments

Comments
 (0)