Skip to content

Commit

Permalink
Fix potentially server-crashing NPE
Browse files Browse the repository at this point in the history
Whoops.
  • Loading branch information
Jikoo committed Nov 17, 2016
1 parent e100dff commit 2e41b4b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import net.minecraft.server.v1_11_R1.ContainerChest;
import net.minecraft.server.v1_11_R1.EntityHuman;
import net.minecraft.server.v1_11_R1.IInventory;
import net.minecraft.server.v1_11_R1.ItemStack;
import net.minecraft.server.v1_11_R1.PlayerInventory;

public class SilentContainerChest extends ContainerChest {
Expand All @@ -37,9 +38,9 @@ public void b(EntityHuman entityHuman) {
// Don't send close signal twice, might screw up
PlayerInventory playerinventory = entityHuman.inventory;

if (playerinventory.getCarried() != null) {
if (!playerinventory.getCarried().isEmpty()) {
entityHuman.drop(playerinventory.getCarried(), false);
playerinventory.setCarried(null);
playerinventory.setCarried(ItemStack.a);
}
}
}

0 comments on commit 2e41b4b

Please sign in to comment.