Skip to content

Commit 7b1a2da

Browse files
authored
Merge pull request #3 from shimo-react-native/fix/nullpoint-bug-1
Update RNFetchBlobFS.java
2 parents 1c3e0e1 + b32d579 commit 7b1a2da

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,13 @@ static public Map<String, Object> getSystemfolders(ReactApplicationContext ctx)
215215
state = Environment.getExternalStorageState();
216216
if (state.equals(Environment.MEDIA_MOUNTED)) {
217217
res.put("SDCardDir", Environment.getExternalStorageDirectory().getAbsolutePath());
218-
res.put("SDCardApplicationDir", ctx.getExternalFilesDir(null).getParentFile().getAbsolutePath());
218+
final File externalFilesDir = ctx.getExternalFilesDir(null);
219+
if (externalFilesDir != null) {
220+
final File parentFile = externalFilesDir.getParentFile();
221+
if (parentFile != null) {
222+
res.put("SDCardApplicationDir", parentFile.getAbsolutePath());
223+
}
224+
}
219225
}
220226
res.put("MainBundleDir", ctx.getApplicationInfo().dataDir);
221227
return res;

0 commit comments

Comments
 (0)