Fix possible NPE for findExpansionsOnDisk

This commit is contained in:
Andre601 2021-12-01 19:09:02 +01:00
parent e969f37405
commit 3ba29f1147

View File

@ -370,7 +370,12 @@ public final class LocalExpansionManager implements Listener {
@NotNull
public CompletableFuture<@NotNull List<@Nullable Class<? extends PlaceholderExpansion>>> findExpansionsOnDisk() {
return Arrays.stream(folder.listFiles((dir, name) -> name.endsWith(".jar")))
File[] files = folder.listFiles((dir, name) -> name.endsWith(".jar"));
if(files == null){
return CompletableFuture.supplyAsync(Collections::emptyList);
}
return Arrays.stream(files)
.map(this::findExpansionInFile)
.collect(Futures.collector());
}