Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Commit

Permalink
fix #259 getExternalFilesDirs may be null if shared storage is not cu…
Browse files Browse the repository at this point in the history
…rrently available (#260)
  • Loading branch information
marandaneto authored Feb 4, 2020
1 parent 416053c commit 291414a
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,11 @@ private File getExternalStorageDep(File internalStorage) {
String internalStoragePath =
internalStorage != null ? internalStorage.getAbsolutePath() : null;
for (File file : externalFilesDirs) {
// externalFilesDirs may contain null values :(
if (file == null) {
continue;
}

// return the 1st file if you cannot compare with the internal one
if (internalStoragePath == null || internalStoragePath.isEmpty()) {
return file;
Expand Down

0 comments on commit 291414a

Please sign in to comment.