aboutsummaryrefslogtreecommitdiff
path: root/src/github/daneren2005
diff options
context:
space:
mode:
Diffstat (limited to 'src/github/daneren2005')
-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);
}
}