Fix NPE that occurs when STACK_TO_64 is true (DevBukkit-1222)

This commit is contained in:
Phoenix616 2017-08-06 11:29:46 +01:00
parent 0413f24e64
commit 9a9e89206b

View File

@ -153,7 +153,9 @@ public class InventoryUtil {
ItemStack currentItem = inventory.getItem(currentSlot); ItemStack currentItem = inventory.getItem(currentSlot);
if (MaterialUtil.isEmpty(currentItem)) { if (MaterialUtil.isEmpty(currentItem)) {
currentItem = new ItemStack(item);
currentItem.setAmount(Math.min(amountLeft, maxStackSize)); currentItem.setAmount(Math.min(amountLeft, maxStackSize));
inventory.setItem(currentSlot, currentItem);
amountLeft -= currentItem.getAmount(); amountLeft -= currentItem.getAmount();
} else if (currentItem.getAmount() < maxStackSize && MaterialUtil.equals(currentItem, item)) { } else if (currentItem.getAmount() < maxStackSize && MaterialUtil.equals(currentItem, item)) {