From 3ba29f11476fd255232eed9923c542d70b600e83 Mon Sep 17 00:00:00 2001 From: Andre601 <11576465+Andre601@users.noreply.github.com> Date: Wed, 1 Dec 2021 19:09:02 +0100 Subject: [PATCH] Fix possible NPE for findExpansionsOnDisk --- .../expansion/manager/LocalExpansionManager.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/clip/placeholderapi/expansion/manager/LocalExpansionManager.java b/src/main/java/me/clip/placeholderapi/expansion/manager/LocalExpansionManager.java index 5ba2821..29db58b 100644 --- a/src/main/java/me/clip/placeholderapi/expansion/manager/LocalExpansionManager.java +++ b/src/main/java/me/clip/placeholderapi/expansion/manager/LocalExpansionManager.java @@ -370,7 +370,12 @@ public final class LocalExpansionManager implements Listener { @NotNull public CompletableFuture<@NotNull List<@Nullable Class>> 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()); }