Fix NPE when pressing keybind with no held item

This commit is contained in:
Nicholas Ignoffo 2016-06-07 16:21:23 -07:00
parent 8d66575530
commit b1d73e3383

View file

@ -23,7 +23,7 @@ public class BMKeyBinding extends KeyBinding
public void handleKeyPress() public void handleKeyPress()
{ {
ItemStack itemStack = ClientHandler.minecraft.thePlayer.getHeldItemMainhand(); ItemStack itemStack = ClientHandler.minecraft.thePlayer.getHeldItemMainhand();
if (itemStack.getItem() instanceof IKeybindable) if (itemStack != null && itemStack.getItem() instanceof IKeybindable)
{ {
BloodMagicPacketHandler.INSTANCE.sendToServer(new KeyProcessor(this.keyType, false)); BloodMagicPacketHandler.INSTANCE.sendToServer(new KeyProcessor(this.keyType, false));
} }