Skip to content

Commit

Permalink
Merge pull request #62 from poison/master
Browse files Browse the repository at this point in the history
Bug Fix: getExternalFilesDir null check
  • Loading branch information
Shem committed Jun 7, 2018
2 parents a3cf145 + 4c4c5ea commit c9b8b91
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,11 @@ static public Map<String, Object> getSystemfolders(ReactApplicationContext ctx)
state = Environment.getExternalStorageState();
if (state.equals(Environment.MEDIA_MOUNTED)) {
res.put("SDCardDir", Environment.getExternalStorageDirectory().getAbsolutePath());
res.put("SDCardApplicationDir", ctx.getExternalFilesDir(null).getParentFile().getAbsolutePath());

File externalDirectory = ctx.getExternalFilesDir(null);
if (externalDirectory != null) {
res.put("SDCardApplicationDir", externalDirectory.getParentFile().getAbsolutePath());
}
}
res.put("MainBundleDir", ctx.getApplicationInfo().dataDir);
return res;
Expand Down

0 comments on commit c9b8b91

Please sign in to comment.