Skip to content

Commit

Permalink
Fix if isExternalStorageRemovable throws (appears to have been due to…
Browse files Browse the repository at this point in the history
… testing against a external usb stick?)
  • Loading branch information
daneren2005 committed Nov 18, 2015
1 parent 128f979 commit 24f4b63
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/src/main/java/github/daneren2005/dsub/util/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,12 @@ private static File getBestDir(File[] dirs) {
// Past 5.0 we can query directly for SD Card
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
for(int i = 0; i < dirs.length; i++) {
if(dirs[i] != null && Environment.isExternalStorageRemovable(dirs[i])) {
return dirs[i];
try {
if (dirs[i] != null && Environment.isExternalStorageRemovable(dirs[i])) {
return dirs[i];
}
} catch (Exception e) {
Log.e(TAG, "Failed to check if is external", e);
}
}
}
Expand Down

0 comments on commit 24f4b63

Please sign in to comment.