Skip to content

Commit

Permalink
Fix exception when removing random item if inventory is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Galajus committed Aug 8, 2022
1 parent e206ce2 commit 3593eca
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ public void effectRemoveRandomItem() {
for (ItemStack itemStack : hunted.getInventory()) {
if (itemStack != null) huntedItems.add(itemStack);
}
if (huntedItems.isEmpty()) {
return;
}
int rand = new Random().nextInt(huntedItems.size());
hunted.getInventory().removeItem(huntedItems.get(rand));
}
Expand Down

0 comments on commit 3593eca

Please sign in to comment.