aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-02-06 19:52:17 -0800
committerScott Jackson <daneren2005@gmail.com>2014-02-06 19:52:17 -0800
commit35a56bb221f67d4ae6cfef2eb0e689c00cded96b (patch)
treeb54762b248aabe096940d3c3abfd0ac80a4bcba8
parent47efa0e85266bc390513854ac89fca914fe9f93b (diff)
downloaddsub-35a56bb221f67d4ae6cfef2eb0e689c00cded96b.tar.gz
dsub-35a56bb221f67d4ae6cfef2eb0e689c00cded96b.tar.bz2
dsub-35a56bb221f67d4ae6cfef2eb0e689c00cded96b.zip
Check if file list is null
-rw-r--r--src/github/daneren2005/dsub/util/Util.java19
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;
+ }
}
}
}