From 326c1b2ce18e32df8fff0db0ee3fa049249d53b3 Mon Sep 17 00:00:00 2001 From: ray Date: Fri, 2 Dec 2005 22:56:01 +0000 Subject: [PATCH] listFiles() can return null if the File its called on is not a directory, or if any unspecified error or hiccup occurs within the acidic innards of the JVM. If that's the case, we probably will fail deleting the directory itself below these lines, but it's better than throwing a NPE and sticking a fork in everything. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1736 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../samskivert/src/java/com/samskivert/util/FileUtil.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/samskivert/src/java/com/samskivert/util/FileUtil.java b/projects/samskivert/src/java/com/samskivert/util/FileUtil.java index 09c5105e..802afd70 100644 --- a/projects/samskivert/src/java/com/samskivert/util/FileUtil.java +++ b/projects/samskivert/src/java/com/samskivert/util/FileUtil.java @@ -49,8 +49,10 @@ public class FileUtil { if (file.isDirectory()) { File[] files = file.listFiles(); - for (int ii = 0; ii < files.length; ii++) { - recursiveWipe(files[ii], true); + if (files != null) { + for (int ii = 0; ii < files.length; ii++) { + recursiveWipe(files[ii], true); + } } } if (wipeMe) {