Skip to content

Commit c9b8b91

Browse files
author
Shem
authored
Merge pull request #62 from poison/master
Bug Fix: getExternalFilesDir null check
2 parents a3cf145 + 4c4c5ea commit c9b8b91

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,11 @@ static public Map<String, Object> getSystemfolders(ReactApplicationContext ctx)
213213
state = Environment.getExternalStorageState();
214214
if (state.equals(Environment.MEDIA_MOUNTED)) {
215215
res.put("SDCardDir", Environment.getExternalStorageDirectory().getAbsolutePath());
216-
res.put("SDCardApplicationDir", ctx.getExternalFilesDir(null).getParentFile().getAbsolutePath());
216+
217+
File externalDirectory = ctx.getExternalFilesDir(null);
218+
if (externalDirectory != null) {
219+
res.put("SDCardApplicationDir", externalDirectory.getParentFile().getAbsolutePath());
220+
}
217221
}
218222
res.put("MainBundleDir", ctx.getApplicationInfo().dataDir);
219223
return res;

0 commit comments

Comments
 (0)