diff options
-rw-r--r-- | src/github/daneren2005/dsub/util/Util.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/github/daneren2005/dsub/util/Util.java b/src/github/daneren2005/dsub/util/Util.java index 05dbb1c3..5b79e2f2 100644 --- a/src/github/daneren2005/dsub/util/Util.java +++ b/src/github/daneren2005/dsub/util/Util.java @@ -606,14 +606,17 @@ public final class Util { } public static boolean recursiveDelete(File dir) { if (dir != null && dir.exists()) { - for(File file: dir.listFiles()) { - if(file.isDirectory()) { - if(!recursiveDelete(file)) { - return false; - } - } else if(file.exists()) { - if(!file.delete()) { - return false; + File[] list = dir.listFiles(); + if(list != null) { + for(File file: list) { + if(file.isDirectory()) { + if(!recursiveDelete(file)) { + return false; + } + } else if(file.exists()) { + if(!file.delete()) { + return false; + } } } } |