Skip to content

Commit

Permalink
Avoid NPE with ibc
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Jan 22, 2022
1 parent 360ba0b commit e8dffc7
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ AtLimitResult atLimit(Island island, Entity ent) {
.filter(e -> e.getType().equals(ent.getType()))
.filter(e -> island.inIslandSpace(e.getLocation()))
.count();
int max = limitAmount + ibc.getEntityLimitOffset(ent.getType());
int max = limitAmount + (ibc == null ? 0 : ibc.getEntityLimitOffset(ent.getType()));
if (count >= max) {
return new AtLimitResult(ent.getType(), max);
}
Expand All @@ -426,7 +426,7 @@ AtLimitResult atLimit(Island island, Entity ent) {
int count = (int) ent.getWorld().getEntities().stream()
.filter(e -> group.getKey().contains(e.getType()))
.filter(e -> island.inIslandSpace(e.getLocation())).count();
int max = group.getValue() + ibc.getEntityGroupLimitOffset(group.getKey().getName());
int max = group.getValue() + + (ibc == null ? 0 : ibc.getEntityGroupLimitOffset(group.getKey().getName()));
if (count >= max) {
return new AtLimitResult(group.getKey(), max);
}
Expand Down

0 comments on commit e8dffc7

Please sign in to comment.