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
This commit is contained in:
Simeon Radivoev 2015-08-04 12:49:54 +03:00
parent 800587ac35
commit 326e93b85d

View file

@ -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)