From b015efd63855b3458aa0133f537efbcfedbe32f8 Mon Sep 17 00:00:00 2001 From: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Date: Wed, 14 Feb 2024 19:39:44 +0100 Subject: Fixed an error when trying to use the shift click feature in empty NPC sell inventory. #996 --- .../at/hannibal2/skyhanni/features/inventory/ShiftClickNPCSell.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickNPCSell.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickNPCSell.kt index fbdd047db..b1a95c313 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickNPCSell.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickNPCSell.kt @@ -29,9 +29,10 @@ object ShiftClickNPCSell { @SubscribeEvent fun onOpen(event: InventoryFullyOpenedEvent) { if (!LorenzUtils.inSkyBlock) return - val item = event.inventoryItems[event.inventoryItems.keys.last() + sellSlot] + if (event.inventoryItems.isEmpty()) return + val item = event.inventoryItems[event.inventoryItems.keys.last() + sellSlot] ?: return - inInventory = lastLoreLineOfSellPattern.matches(item?.getLore()?.lastOrNull()) + inInventory = lastLoreLineOfSellPattern.matches(item.getLore().lastOrNull()) } @SubscribeEvent -- cgit