Fixes possible NPE when a furnace is destroyed while someone is still

viewing it.
This commit is contained in:
GJ 2013-01-24 11:49:51 -05:00
parent ab677e941d
commit 9dac898c1c

View File

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