Skip to content

Commit

Permalink
Merge pull request #121 from ihavenoface5/ReadableMapNullCheck
Browse files Browse the repository at this point in the history
Added null and path key check on addCompleteDownload method
  • Loading branch information
Traviskn authored Jul 17, 2018
2 parents 41e1572 + 4f66c84 commit ebc320f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions android/src/main/java/com/RNFetchBlob/RNFetchBlob.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down

0 comments on commit ebc320f

Please sign in to comment.