From f22e2beceb2d0fbcc16eff8b6271583089c5e29a Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Thu, 18 Apr 2024 17:25:53 +0200 Subject: Fix: NPE in visitor reward warning (#1481) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../skyhanni/features/garden/visitor/VisitorRewardWarning.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorRewardWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorRewardWarning.kt index 61a075bfd..e5df0c050 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorRewardWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorRewardWarning.kt @@ -47,13 +47,13 @@ class VisitorRewardWarning { @SubscribeEvent(priority = EventPriority.HIGH) fun onStackClick(event: GuiContainerEvent.SlotClickEvent) { if (!VisitorAPI.inInventory) return - val slot = event.slot ?: return + val stack = event.slot?.stack ?: return val visitor = VisitorAPI.getVisitor(lastClickedNpc) ?: return val blockReason = visitor.blockReason - val isRefuseSlot = slot.stack.name == "§cRefuse Offer" - val isAcceptSlot = slot.stack.name == "§aAccept Offer" + val isRefuseSlot = stack.name == "§cRefuse Offer" + val isAcceptSlot = stack.name == "§aAccept Offer" if (blockReason != null && !config.bypassKey.isKeyHeld() && ((blockReason.blockRefusing && isRefuseSlot) || !blockReason.blockRefusing && isAcceptSlot)) { @@ -66,7 +66,7 @@ class VisitorRewardWarning { return } if (isAcceptSlot) { - if (slot.stack?.name != "§eClick to give!") return + if (stack.name != "§eClick to give!") return VisitorAPI.changeStatus(visitor, VisitorAPI.VisitorStatus.ACCEPTED, "accepted") return } -- cgit