Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

Commit

Permalink
Fixed a null reference crash
Browse files Browse the repository at this point in the history
When shift clicking an empty slot - CRASH

Closes #13
  • Loading branch information
renevo committed Mar 22, 2017
1 parent 4d66c01 commit 0a777cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod_version=1.5.0
mod_version=1.5.1
minecraft_version=1.11.2
forge_version=13.20.0.2255
mappings=snapshot_20161220
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/renevo/pcb/ContainerPortableCraftBench.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public ContainerPortableCraftBench(InventoryPlayer inventoryPlayer, World world,
*/
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
ItemStack stack = null;
ItemStack stack = ItemStack.EMPTY;
Slot slot = this.inventorySlots.get(slotIndex);

if (slot != null && slot.getHasStack()) {
Expand All @@ -28,20 +28,20 @@ public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {

if (slotIndex == 0) {
if (!this.mergeItemStack(slotStack, 10, 46, true)) {
return null;
return ItemStack.EMPTY;
}

slot.onSlotChange(slotStack, stack);
} else if (slotIndex >= 10 && slotIndex < 37) {
if (!this.mergeItemStack(slotStack, 1, 10, false)) {
return null;
return ItemStack.EMPTY;
}
} else if (slotIndex >= 37 && slotIndex < 46) {
if (!this.mergeItemStack(slotStack, 1, 10, false)) {
return null;
return ItemStack.EMPTY;
}
} else if (!this.mergeItemStack(slotStack, 10, 46, false)) {
return null;
return ItemStack.EMPTY;
}

if (slotStack.isEmpty()) {
Expand All @@ -51,7 +51,7 @@ public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
}

if (slotStack.getCount() == stack.getCount()) {
return null;
return ItemStack.EMPTY;
}

slot.onTake(player, slotStack);
Expand Down

0 comments on commit 0a777cf

Please sign in to comment.