From 8a6ed3a88b8cd8c08320157b605a63f56e9c4c88 Mon Sep 17 00:00:00 2001 From: Des Herriott Date: Thu, 27 Feb 2014 12:32:21 +0000 Subject: [PATCH] Check that item in hand is not null after book event. Fixes BUKKIT-5443 --- .../java/org/bukkit/craftbukkit/event/CraftEventFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 4cc25f2c5f..30f31d1fc4 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -709,7 +709,7 @@ public class CraftEventFactory { ItemStack itemInHand = player.inventory.getItem(itemInHandIndex); // If they've got the same item in their hand, it'll need to be updated. - if (itemInHand.getItem() == Items.BOOK_AND_QUILL) { + if (itemInHand != null && itemInHand.getItem() == Items.BOOK_AND_QUILL) { if (!editBookEvent.isCancelled()) { CraftItemStack.setItemMeta(itemInHand, editBookEvent.getNewBookMeta()); if (editBookEvent.isSigning()) {