Fix NPE in StockCounter on autofill/no item found (Fixes #376)

This commit is contained in:
Phoenix616 2020-11-02 01:06:48 +01:00
parent b43454531e
commit 7a1c091c74
No known key found for this signature in database
GPG Key ID: 40E2321E71738EB0

View File

@ -54,10 +54,12 @@ public class StockCounterModule implements Listener {
} }
ItemStack itemTradedByShop = determineItemTradedByShop(event.getSignLine(ITEM_LINE)); ItemStack itemTradedByShop = determineItemTradedByShop(event.getSignLine(ITEM_LINE));
if (itemTradedByShop != null) {
Inventory chestShopInventory = uBlock.findConnectedContainer(event.getSign()).getInventory(); Inventory chestShopInventory = uBlock.findConnectedContainer(event.getSign()).getInventory();
event.setSignLine(QUANTITY_LINE, getQuantityLineWithCounter(quantity, itemTradedByShop, chestShopInventory)); event.setSignLine(QUANTITY_LINE, getQuantityLineWithCounter(quantity, itemTradedByShop, chestShopInventory));
} }
}
@EventHandler @EventHandler
public static void onInventoryClose(InventoryCloseEvent event) { public static void onInventoryClose(InventoryCloseEvent event) {