mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-03 06:40:19 +08:00
SPIGOT-3342: Fix invalid usage of null in InventoryWrapper
This commit is contained in:
parent
732911efbc
commit
885da43758
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user