mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2024-11-18 00:46:55 +01:00
Fix possible NPE for findExpansionsOnDisk
This commit is contained in:
parent
e969f37405
commit
3ba29f1147
@ -370,7 +370,12 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public CompletableFuture<@NotNull List<@Nullable Class<? extends PlaceholderExpansion>>> findExpansionsOnDisk() {
|
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)
|
.map(this::findExpansionInFile)
|
||||||
.collect(Futures.collector());
|
.collect(Futures.collector());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user