Skip to content

Commit

Permalink
Add NPE protection
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Sep 20, 2024
1 parent 6b9262e commit f08c458
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/world/bentobox/limits/Limits.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,13 @@ private String getLimit(@Nullable User user, Material m, GameModeAddon gm) {
if (is == null) {
return LIMIT_NOT_SET;
}
// Check the permissions of the user and update
this.getJoinListener().checkPerms(user.getPlayer(), gm.getPermissionPrefix() + "island.limit.",
is.getUniqueId(), gm.getDescription().getName());

if (user != null) {
// Check the permissions of the user and update
this.getJoinListener().checkPerms(user.getPlayer(), gm.getPermissionPrefix() + "island.limit.",
is.getUniqueId(), gm.getDescription().getName());
}
int limit = this.getBlockLimitListener().
getMaterialLimits(is.getWorld(), is.getUniqueId()).
getOrDefault(m, -1);
getMaterialLimits(is.getWorld(), is.getUniqueId()).getOrDefault(m, -1);

return limit == -1 ? LIMIT_NOT_SET : String.valueOf(limit);
}
Expand Down

0 comments on commit f08c458

Please sign in to comment.