From 326e93b85d0665349b63483aa1c0ea87ed66fce0 Mon Sep 17 00:00:00 2001 From: Simeon Radivoev Date: Tue, 4 Aug 2015 12:49:54 +0300 Subject: [PATCH] Added itemstack null check on canReplace Added null check for itemstack to prevent crashing when getting metadata from null itemstack. In response of simeonradivoev/MatterOverdrive#150 --- .../common/blocks/templates/BOPBlockWorldDecor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/biomesoplenty/common/blocks/templates/BOPBlockWorldDecor.java b/src/main/java/biomesoplenty/common/blocks/templates/BOPBlockWorldDecor.java index 4040730af..3438882ff 100644 --- a/src/main/java/biomesoplenty/common/blocks/templates/BOPBlockWorldDecor.java +++ b/src/main/java/biomesoplenty/common/blocks/templates/BOPBlockWorldDecor.java @@ -35,8 +35,8 @@ public abstract class BOPBlockWorldDecor extends BlockBush public boolean canReplace(World world, int x, int y, int z, int side, ItemStack itemStack) { if (world.getBlock(x, y - 1, z) == Blocks.air) return false; - - return isValidPosition(world, x, y, z, itemStack.getItemDamage()); + + return isValidPosition(world, x, y, z, itemStack != null ? itemStack.getItemDamage() : 0); } public void dropIfCantStay(World world, int x, int y, int z, ItemStack stack)