fix: Avoid NPE if the CA's files cannot be listed
authorBenny Baumann <BenBE1987@gmx.net>
Sun, 7 Aug 2016 00:54:40 +0000 (02:54 +0200)
committerBenny Baumann <BenBE1987@gmx.net>
Sun, 7 Aug 2016 11:49:51 +0000 (13:49 +0200)
Change-Id: I9b113de12b0305bddf49747eef54f6062048544b

util-testing/org/cacert/gigi/util/SimpleSigner.java

index 0c36a3bcbbb6a554a14126047217c61d03788aca..1cc9e9eeae6e8e7851e540113a6cc1da1fda9ce8 100644 (file)
@@ -329,7 +329,11 @@ public class SimpleSigner {
                 }
                 String ca = caP.getProperty("ca") + "_2015_1";
                 File parent = new File("signer/ca");
-                for (File f : parent.listFiles()) {
+                File[] caFiles = parent.listFiles();
+                if (null == caFiles) {
+                    caFiles = new File[0];
+                }
+                for (File f : caFiles) {
                     if (f.getName().startsWith(caP.getProperty("ca"))) {
                         ca = f.getName();
                         break;