Skip to content

Commit

Permalink
Ignore NPE's and return 0 on essentials' economy API failure
Browse files Browse the repository at this point in the history
  • Loading branch information
novucs committed Jan 9, 2017
1 parent fabed39 commit 1d6eaec
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ public double getBalance(Player player) {

@Override
public double getBalance(UUID playerId) {
User user = essentials.getUser(playerId);
User user;
try {
user = essentials.getUser(playerId);
} catch (NullPointerException e) {
return 0;
}

if (user != null) {
return user.getMoney().doubleValue();
}
Expand Down

0 comments on commit 1d6eaec

Please sign in to comment.