Fixed potential null pointer error
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Sat, 26 Oct 2019 06:00:10 +0000 (09:00 +0300)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Sat, 26 Oct 2019 06:00:10 +0000 (09:00 +0300)
src/main/java/eu/svjatoslav/meviz/htmlindexer/indexer/FilesystemIndexRemover.java

index 9023697..a350109 100644 (file)
@@ -31,9 +31,11 @@ public class FilesystemIndexRemover {
         }
 
         // recursively remove thumbnail directories from sub directories
-        for (final File subFile : workingDirectory.listFiles())
-            if (subFile.isDirectory())
-                removeIndex(subFile);
+        File[] files = workingDirectory.listFiles();
+        if (files != null)
+            for (final File subFile : files)
+                if (subFile.isDirectory())
+                    removeIndex(subFile);
 
         for (final Layout layout : Utils.getLayouts()) {
             final File indexFile = Utils.getLayoutIndexFile(layout,