mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-22 15:24:44 +02:00
Fixes possible NPE when a furnace is destroyed while someone is still
viewing it.
This commit is contained in:
@ -32,6 +32,11 @@ public class InventoryListener implements Listener{
|
|||||||
if (inventoryType == InventoryType.FURNACE) {
|
if (inventoryType == InventoryType.FURNACE) {
|
||||||
FurnaceInventory inventory = (FurnaceInventory) event.getInventory();
|
FurnaceInventory inventory = (FurnaceInventory) event.getInventory();
|
||||||
Furnace furnace = inventory.getHolder();
|
Furnace furnace = inventory.getHolder();
|
||||||
|
|
||||||
|
if (furnace == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Block furnaceBlock = furnace.getBlock();
|
Block furnaceBlock = furnace.getBlock();
|
||||||
|
|
||||||
if (furnace.getBurnTime() == 0 && !plugin.furnaceIsTracked(furnaceBlock)) {
|
if (furnace.getBurnTime() == 0 && !plugin.furnaceIsTracked(furnaceBlock)) {
|
||||||
@ -47,6 +52,11 @@ public class InventoryListener implements Listener{
|
|||||||
if (inventoryType == InventoryType.FURNACE) {
|
if (inventoryType == InventoryType.FURNACE) {
|
||||||
FurnaceInventory inventory = (FurnaceInventory) event.getInventory();
|
FurnaceInventory inventory = (FurnaceInventory) event.getInventory();
|
||||||
Furnace furnace = inventory.getHolder();
|
Furnace furnace = inventory.getHolder();
|
||||||
|
|
||||||
|
if (furnace == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Block furnaceBlock = furnace.getBlock();
|
Block furnaceBlock = furnace.getBlock();
|
||||||
|
|
||||||
if (furnace.getBurnTime() == 0 && plugin.furnaceIsTracked(furnaceBlock)) {
|
if (furnace.getBurnTime() == 0 && plugin.furnaceIsTracked(furnaceBlock)) {
|
||||||
|
Reference in New Issue
Block a user