aboutsummaryrefslogtreecommitdiff
path: root/src/github
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-02-25 10:36:10 -0800
committerScott Jackson <daneren2005@gmail.com>2015-02-25 10:36:10 -0800
commitd489c27ee0bf46cc8bfd47efaa012ad5f09c6b67 (patch)
tree8a462808868a9d6fd4f623db3dde2bf266656f2a /src/github
parent8d66335bf5500b2aa2d80febb5c90c4237a4579a (diff)
downloaddsub-d489c27ee0bf46cc8bfd47efaa012ad5f09c6b67.tar.gz
dsub-d489c27ee0bf46cc8bfd47efaa012ad5f09c6b67.tar.bz2
dsub-d489c27ee0bf46cc8bfd47efaa012ad5f09c6b67.zip
Fix crash for some users when deleting podcasts
Diffstat (limited to 'src/github')
-rw-r--r--src/github/daneren2005/dsub/util/FileUtil.java25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/github/daneren2005/dsub/util/FileUtil.java b/src/github/daneren2005/dsub/util/FileUtil.java
index fbfa6af0..8bd53c0c 100644
--- a/src/github/daneren2005/dsub/util/FileUtil.java
+++ b/src/github/daneren2005/dsub/util/FileUtil.java
@@ -501,17 +501,24 @@ public class FileUtil {
}
public static void deleteEmptyDir(File dir) {
- File[] children = dir.listFiles();
+ try {
+ File[] children = dir.listFiles();
+ if(children == null) {
+ return;
+ }
- // No songs left in the folder
- if(children.length == 1 && children[0].getPath().equals(FileUtil.getAlbumArtFile(dir).getPath())) {
- Util.delete(children[0]);
- children = dir.listFiles();
- }
+ // No songs left in the folder
+ if (children.length == 1 && children[0].getPath().equals(FileUtil.getAlbumArtFile(dir).getPath())) {
+ Util.delete(children[0]);
+ children = dir.listFiles();
+ }
- // Delete empty directory
- if (children.length == 0) {
- Util.delete(dir);
+ // Delete empty directory
+ if (children.length == 0) {
+ Util.delete(dir);
+ }
+ } catch(Exception e) {
+ Log.w(TAG, "Error while trying to delete empty dir", e);
}
}