Fix potential null pointer exception

This commit is contained in:
squeek committed 2015-10-18 18:25:50 -07:00
1 parent f929a3c110
commit 3794f40835
1 file changed
+3 -2
@@ -145,7 +145,7 @@ public class WailaHandler implements IWailaDataProvider
String separator = (!shearability.isEmpty() || !silkTouchability.isEmpty() ? " " : "");
stringList.add(currentlyHarvestable + separator + silkTouchability + (!silkTouchability.isEmpty() ? separator : "") + shearability);
}
if (harvestLevel != -1 && showEffectiveTool)
if (harvestLevel != -1 && showEffectiveTool && effectiveTool != null)
{
String effectiveToolString;
if (StatCollector.canTranslate("wailaharvestability.toolclass." + effectiveTool))
@@ -181,7 +181,8 @@ public class WailaHandler implements IWailaDataProvider
if (showSilkTouchability && block.canSilkHarvest(player.worldObj, player, position.blockX, position.blockY, position.blockZ, meta))
{
boolean silkTouchMatters = block.getItemDropped(meta, new Random(), 0) != Item.getItemFromBlock(block) || block.quantityDropped(new Random()) <= 0;
Item itemDropped = block.getItemDropped(meta, new Random(), 0);
boolean silkTouchMatters = (itemDropped instanceof ItemBlock && itemDropped != Item.getItemFromBlock(block)) || block.quantityDropped(new Random()) <= 0;
if (silkTouchMatters)
{
boolean hasSilkTouch = EnchantmentHelper.getSilkTouchModifier(player);