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
1 changed files with 4 additions and 2 deletions

View File

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