diff --git a/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java b/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java index 71648c595f2..85e66ca30ab 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java +++ b/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java @@ -120,14 +120,16 @@ public final class TestUtil { } private static LinkedHashSet rm(LinkedHashSet unremoved, File... locations) { - for (File location : locations) { - if (location != null && location.exists()) { - if (location.isDirectory()) { - rm(unremoved, location.listFiles()); - } - - if (!location.delete()) { - unremoved.add(location); + if (locations != null) { + for (File location : locations) { + if (location != null && location.exists()) { + if (location.isDirectory()) { + rm(unremoved, location.listFiles()); + } + + if (!location.delete()) { + unremoved.add(location); + } } } }