Fixed NullPointerException in VirtualInventory#putItemStack

When an ItemUpdateEvent set the newItemStack to null, a NullPointerException was thrown.
This has been fixed.
This commit is contained in:
NichtStudioCode 2021-08-02 12:24:52 +02:00
parent cd4c8da7f7
commit c08b7ae5be

@ -411,7 +411,8 @@ public class VirtualInventory implements ConfigurationSerializable {
items[slot] = newItemStack; items[slot] = newItemStack;
notifyWindows(); notifyWindows();
return itemStack.getAmount() - (newItemStack.getAmount() - currentAmount); int newAmount = newItemStack != null ? newItemStack.getAmount() : 0;
return itemStack.getAmount() - (newAmount - currentAmount);
} }
} }
} }