From 35a56bb221f67d4ae6cfef2eb0e689c00cded96b Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Thu, 6 Feb 2014 19:52:17 -0800 Subject: Check if file list is null --- src/github/daneren2005/dsub/util/Util.java | 19 +++++++++++-------- 1 file 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; + } } } } -- cgit v1.2.3