summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2017-06-15 20:25:06 +1000
committermd_5 <git@md-5.net>2017-06-15 20:25:06 +1000
commit885da43758f1e15fc5dbe95cfa1f1020a871356f (patch)
treeab6ca06bd617582b12051532606d514378e9e6ba /src
parent732911efbcead46eae3ef1f4aa628e997966db5e (diff)
downloadcraftbukkit-885da43758f1e15fc5dbe95cfa1f1020a871356f.tar
craftbukkit-885da43758f1e15fc5dbe95cfa1f1020a871356f.tar.gz
craftbukkit-885da43758f1e15fc5dbe95cfa1f1020a871356f.tar.lz
craftbukkit-885da43758f1e15fc5dbe95cfa1f1020a871356f.tar.xz
craftbukkit-885da43758f1e15fc5dbe95cfa1f1020a871356f.zip
SPIGOT-3342: Fix invalid usage of null in InventoryWrapper
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/InventoryWrapper.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/InventoryWrapper.java b/src/main/java/org/bukkit/craftbukkit/inventory/InventoryWrapper.java
index d2a00849..6cbcc9d3 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/InventoryWrapper.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/InventoryWrapper.java
@@ -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);