Check that item in hand is not null after book event. Fixes BUKKIT-5443

This commit is contained in:
Des Herriott 2014-02-27 12:32:21 +00:00 committed by Travis Watkins
parent a86bc7aeb3
commit 8a6ed3a88b

View file

@ -709,7 +709,7 @@ public class CraftEventFactory {
ItemStack itemInHand = player.inventory.getItem(itemInHandIndex); ItemStack itemInHand = player.inventory.getItem(itemInHandIndex);
// If they've got the same item in their hand, it'll need to be updated. // 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()) { if (!editBookEvent.isCancelled()) {
CraftItemStack.setItemMeta(itemInHand, editBookEvent.getNewBookMeta()); CraftItemStack.setItemMeta(itemInHand, editBookEvent.getNewBookMeta());
if (editBookEvent.isSigning()) { if (editBookEvent.isSigning()) {