From 9dac898c1cb3611f45381bd570ec0df039812a75 Mon Sep 17 00:00:00 2001 From: GJ Date: Thu, 24 Jan 2013 11:49:51 -0500 Subject: [PATCH] Fixes possible NPE when a furnace is destroyed while someone is still viewing it. --- .../com/gmail/nossr50/listeners/InventoryListener.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java b/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java index c48cc7a2c..55ae2422e 100644 --- a/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java @@ -32,6 +32,11 @@ public class InventoryListener implements Listener{ if (inventoryType == InventoryType.FURNACE) { FurnaceInventory inventory = (FurnaceInventory) event.getInventory(); Furnace furnace = inventory.getHolder(); + + if (furnace == null) { + return; + } + Block furnaceBlock = furnace.getBlock(); if (furnace.getBurnTime() == 0 && !plugin.furnaceIsTracked(furnaceBlock)) { @@ -47,6 +52,11 @@ public class InventoryListener implements Listener{ if (inventoryType == InventoryType.FURNACE) { FurnaceInventory inventory = (FurnaceInventory) event.getInventory(); Furnace furnace = inventory.getHolder(); + + if (furnace == null) { + return; + } + Block furnaceBlock = furnace.getBlock(); if (furnace.getBurnTime() == 0 && plugin.furnaceIsTracked(furnaceBlock)) {