From d27553cdc2d3c0e37946daeefc310a4b4c99deb3 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 8 Jul 2023 13:08:51 +0200 Subject: Catch and log an error in GardenVisitorFeatures --- .../features/garden/visitor/GardenVisitorFeatures.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index f2e1c07df..8d325bbf9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.features.garden.CropType.Companion.getByNameOrNull import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper +import at.hannibal2.skyhanni.test.command.CopyErrorCommand import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -90,7 +91,16 @@ class GardenVisitorFeatures { if (name.length == name.removeColor().length + 4) { name = name.substring(2) } - val visitor = visitors[name]!! + + val visitor = visitors[name] + if (visitor == null) { + println("visitors: $visitors") + println("name: $name") + println("npcItem.name: ${npcItem.name}") + CopyErrorCommand.logError(RuntimeException("visitor is null! '$name'"), "Error finding the visitor `$name§c`. Try to reopen the inventory") + return + } + visitor.entityId = lastClickedNpc for (line in offerItem.getLore()) { if (line == "§7Items Required:") continue -- cgit