ソースを参照

Merge pull request #62 from poison/master

Bug Fix: getExternalFilesDir null check
Shem 6 年 前
コミット
c9b8b917f2
No account linked to committer's email address
共有1 個のファイルを変更した5 個の追加1 個の削除を含む
  1. 5
    1
      android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java

+ 5
- 1
android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java ファイルの表示

@@ -213,7 +213,11 @@ public class RNFetchBlobFS {
213 213
         state = Environment.getExternalStorageState();
214 214
         if (state.equals(Environment.MEDIA_MOUNTED)) {
215 215
             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
+            }
217 221
         }
218 222
         res.put("MainBundleDir", ctx.getApplicationInfo().dataDir);
219 223
         return res;