Skip to content

Commit

Permalink
Fix NPE
Browse files Browse the repository at this point in the history
NPE occured if no players were given.
  • Loading branch information
APickledWalrus committed May 5, 2020
1 parent e2991be commit 0023f19
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,18 @@ public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelaye

@Override
protected String[] get(final Event e) {
String[] placeholders = this.placeholders.getArray(e);
OfflinePlayer[] players = this.players.getArray(e);
List<String> values = new ArrayList<>();
if (players.length != 0) {
String[] placeholders = this.placeholders.getArray(e);
if (this.players == null) {
for (String pl : placeholders) {
for (OfflinePlayer p : players) {
values.add(getPlaceholder(pl, p));
}
values.add(getPlaceholder(pl, null));
}
} else {
OfflinePlayer[] players = this.players.getArray(e);
for (String pl : placeholders) {
values.add(getPlaceholder(pl, null));
for (OfflinePlayer p : players) {
values.add(getPlaceholder(pl, p));
}
}
}
return values.toArray(new String[0]);
Expand Down

0 comments on commit 0023f19

Please sign in to comment.