From 3ec7b082be76aaedb91e4a99915a00cd0c50231c Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Thu, 25 Aug 2022 11:41:05 +0200 Subject: [PATCH] Prevent NPEs in file walker --- .../backend/FileBasedCertificateDirectoryBackend.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pgp-cert-d-java/src/main/java/pgp/cert_d/backend/FileBasedCertificateDirectoryBackend.java b/pgp-cert-d-java/src/main/java/pgp/cert_d/backend/FileBasedCertificateDirectoryBackend.java index def57e6..1ffc550 100644 --- a/pgp-cert-d-java/src/main/java/pgp/cert_d/backend/FileBasedCertificateDirectoryBackend.java +++ b/pgp-cert-d-java/src/main/java/pgp/cert_d/backend/FileBasedCertificateDirectoryBackend.java @@ -217,6 +217,10 @@ public class FileBasedCertificateDirectoryBackend implements PGPCertificateDirec } }); + if (subdirectories == null) { + subdirectories = new File[0]; + } + for (File subdirectory : subdirectories) { File[] files = subdirectory.listFiles(new FileFilter() { @Override @@ -225,6 +229,10 @@ public class FileBasedCertificateDirectoryBackend implements PGPCertificateDirec } }); + if (files == null) { + files = new File[0]; + } + for (File certFile : files) { certificateQueue.add(new Lazy() { @Override