Add in checks for potential NPEs. Fixes BUKKIT-1706 and BUKKIT-1590.

This commit is contained in:
Travis Watkins
2012-05-24 19:11:05 -05:00
parent 2f16b8ffa3
commit c1bc0df718
4 changed files with 13 additions and 1 deletions

View File

@@ -240,7 +240,8 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
getHandle().effects.remove(type.getId());
getHandle().e = true; // Should be called updateEffects
if (getHandle() instanceof EntityPlayer) {
((EntityPlayer)getHandle()).netServerHandler.sendPacket(new Packet42RemoveMobEffect(getHandle().id, new MobEffect(type.getId(), 0, 0)));
if (((EntityPlayer) getHandle()).netServerHandler == null) return;
((EntityPlayer) getHandle()).netServerHandler.sendPacket(new Packet42RemoveMobEffect(getHandle().id, new MobEffect(type.getId(), 0, 0)));
}
}