Prevent NPEs in file walker

This commit is contained in:
Paul Schaub 2022-08-25 11:41:05 +02:00
parent 2758c3efb8
commit 3ec7b082be
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -217,6 +217,10 @@ public class FileBasedCertificateDirectoryBackend implements PGPCertificateDirec
} }
}); });
if (subdirectories == null) {
subdirectories = new File[0];
}
for (File subdirectory : subdirectories) { for (File subdirectory : subdirectories) {
File[] files = subdirectory.listFiles(new FileFilter() { File[] files = subdirectory.listFiles(new FileFilter() {
@Override @Override
@ -225,6 +229,10 @@ public class FileBasedCertificateDirectoryBackend implements PGPCertificateDirec
} }
}); });
if (files == null) {
files = new File[0];
}
for (File certFile : files) { for (File certFile : files) {
certificateQueue.add(new Lazy<Certificate>() { certificateQueue.add(new Lazy<Certificate>() {
@Override @Override