From 280719a1ef1ae7c5341cdd9ec9d72680a5dfa788 Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Mon, 8 Feb 2016 18:17:03 -0500 Subject: [PATCH] Fix crash when right-clicking controller with empty hand. --- build.gradle | 2 +- .../storagedrawers/block/tile/TileEntityController.java | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 98c7fb9..2d949eb 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.7.10-1.7.8" +version = "1.7.10-1.7.9" group= "com.jaquadro.minecraft.storagedrawers" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "StorageDrawers" diff --git a/src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityController.java b/src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityController.java index c2dc52e..ac271ac 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityController.java +++ b/src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityController.java @@ -157,10 +157,11 @@ public class TileEntityController extends TileEntity implements IDrawerGroup, IP if (!dumpInventory) { ItemStack currentStack = player.inventory.getCurrentItem(); - count = insertItems(currentStack); - - if (currentStack.stackSize == 0) - player.inventory.setInventorySlotContents(player.inventory.currentItem, null); + if (currentStack != null) { + count = insertItems(currentStack); + if (currentStack.stackSize == 0) + player.inventory.setInventorySlotContents(player.inventory.currentItem, null); + } } else { for (int i = 0, n = player.inventory.getSizeInventory(); i < n; i++) {