Fixed NPE with null ItemStack for pumpkin scuba in EntityDamageEvent.

This commit is contained in:
sk89q 2012-03-02 10:33:14 -08:00
parent 10296cb736
commit ddefbfe2cf

View File

@ -414,10 +414,13 @@ public void onEntityDamage(EntityDamageEvent event) {
event.setCancelled(true);
return;
}
ItemStack helmet = player.getInventory().getHelmet();
if (type == DamageCause.DROWNING && wcfg.pumpkinScuba
&& (player.getInventory().getHelmet().getTypeId() == BlockID.PUMPKIN
|| player.getInventory().getHelmet().getTypeId() == BlockID.JACKOLANTERN)) {
&& helmet != null
&& (helmet.getTypeId() == BlockID.PUMPKIN
|| helmet.getTypeId() == BlockID.JACKOLANTERN)) {
player.setRemainingAir(player.getMaximumAir());
event.setCancelled(true);
return;