SPIGOT-3342: Fix invalid usage of null in InventoryWrapper

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2017-06-15 20:25:06 +10:00
commit 0fab9a4f3a

View file

@ -39,11 +39,11 @@ public class InventoryWrapper implements IInventory {
// Copied from CraftItemStack
ItemStack stack = getItem(i);
ItemStack result;
if (stack == null) {
return null;
if (stack.isEmpty()) {
return stack;
}
if (stack.getCount() <= j) {
this.setItem(i, null);
this.setItem(i, ItemStack.a);
result = stack;
} else {
result = CraftItemStack.copyNMSStack(stack, j);
@ -58,11 +58,11 @@ public class InventoryWrapper implements IInventory {
// Copied from CraftItemStack
ItemStack stack = getItem(i);
ItemStack result;
if (stack == null) {
return null;
if (stack.isEmpty()) {
return stack;
}
if (stack.getCount() <= 1) {
this.setItem(i, null);
this.setItem(i, ItemStack.a);
result = stack;
} else {
result = CraftItemStack.copyNMSStack(stack, 1);