Fixed NPE in PlayerInteractEvent regarding infinite stack removal.

This commit is contained in:
sk89q 2012-03-01 19:52:53 -08:00
parent e957f92496
commit cf5a5b5b47

View File

@ -330,7 +330,7 @@ public void onPlayerInteract(PlayerInteractEvent event) {
&& !plugin.hasPermission(player, "worldguard.override.infinite-stack")) {
int slot = player.getInventory().getHeldItemSlot();
ItemStack heldItem = player.getInventory().getItem(slot);
if (heldItem.getAmount() < 0) {
if (heldItem != null && heldItem.getAmount() < 0) {
player.getInventory().setItem(slot, null);
player.sendMessage(ChatColor.RED + "Infinite stack removed.");
}