aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-05-07 23:05:11 +0200
committerGitHub <noreply@github.com>2024-05-07 23:05:11 +0200
commit2584f0f1a451fcbc5f7ba38c65678e08ee397d23 (patch)
tree52454cf16fdccb49ea98f7f263363b38ebb532c0 /src
parentfaa42fc9f9de3b1e61b1a3d540218d00f2b63232 (diff)
downloadskyhanni-2584f0f1a451fcbc5f7ba38c65678e08ee397d23.tar.gz
skyhanni-2584f0f1a451fcbc5f7ba38c65678e08ee397d23.tar.bz2
skyhanni-2584f0f1a451fcbc5f7ba38c65678e08ee397d23.zip
Fix: npe in inventory utils (#1728)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt
index 5182c5c54..e3f06b83b 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt
@@ -79,7 +79,8 @@ object InventoryUtils {
fun isSlotInPlayerInventory(itemStack: ItemStack): Boolean {
val screen = Minecraft.getMinecraft().currentScreen as? GuiContainer ?: return false
- return screen.slotUnderMouse.inventory is InventoryPlayer && screen.slotUnderMouse.stack == itemStack
+ val slotUnderMouse = screen.slotUnderMouse ?: return false
+ return slotUnderMouse.inventory is InventoryPlayer && slotUnderMouse.stack == itemStack
}
fun isItemInInventory(name: NEUInternalName) = name.getAmountInInventory() > 0