diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-03-30 08:28:29 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-03-30 08:28:29 -0700 |
commit | eb23df04d814deb9405ae28db13d62264085cd6c (patch) | |
tree | ec46441a48e43c46c7711a7fc5b9dc55737069db | |
parent | 7811c911575c03dbdf7d6a1a334228210ada66f3 (diff) | |
download | dsub-eb23df04d814deb9405ae28db13d62264085cd6c.tar.gz dsub-eb23df04d814deb9405ae28db13d62264085cd6c.tar.bz2 dsub-eb23df04d814deb9405ae28db13d62264085cd6c.zip |
Throw storage warning in try/catch block
-rw-r--r-- | src/github/daneren2005/dsub/fragments/SubsonicFragment.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java index d4b222b2..fcba86a2 100644 --- a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java +++ b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java @@ -625,10 +625,14 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR Util.toast(context, R.string.select_album_no_sdcard);
}
- StatFs stat = new StatFs(FileUtil.getMusicDirectory(context).getPath());
- long bytesAvailableFs = (long) stat.getAvailableBlocks() * (long) stat.getBlockSize();
- if(bytesAvailableFs < 50000000L) {
- Util.toast(context, context.getResources().getString(R.string.select_album_no_room, Util.formatBytes(bytesAvailableFs)));
+ try {
+ StatFs stat = new StatFs(FileUtil.getMusicDirectory(context).getPath());
+ long bytesAvailableFs = (long) stat.getAvailableBlocks() * (long) stat.getBlockSize();
+ if (bytesAvailableFs < 50000000L) {
+ Util.toast(context, context.getResources().getString(R.string.select_album_no_room, Util.formatBytes(bytesAvailableFs)));
+ }
+ } catch(Exception e) {
+ Log.w(TAG, "Error while checking storage space for music directory", e);
}
}
|