diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-11-17 17:23:40 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-11-17 17:23:40 -0800 |
commit | 24f4b63df3394425545d602a92d7ddd1ebccb463 (patch) | |
tree | 5a3f845164e3c637a384519ead214db46070f400 | |
parent | 128f979438b3d2151123392ddc0e524d34feaf1f (diff) | |
download | dsub-24f4b63df3394425545d602a92d7ddd1ebccb463.tar.gz dsub-24f4b63df3394425545d602a92d7ddd1ebccb463.tar.bz2 dsub-24f4b63df3394425545d602a92d7ddd1ebccb463.zip |
Fix if isExternalStorageRemovable throws (appears to have been due to testing against a external usb stick?)
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/util/FileUtil.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/util/FileUtil.java b/app/src/main/java/github/daneren2005/dsub/util/FileUtil.java index 2495db17..04dc73b7 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/FileUtil.java +++ b/app/src/main/java/github/daneren2005/dsub/util/FileUtil.java @@ -484,8 +484,12 @@ public class FileUtil { // 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); } } } |