aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-07-08 13:08:51 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-07-08 13:09:14 +0200
commitd27553cdc2d3c0e37946daeefc310a4b4c99deb3 (patch)
tree912e73088a6856bb0c81ca465033ee992b5bfef1 /src/main
parent4f12dd34459479a292d90110fcee5d32696129fd (diff)
downloadskyhanni-d27553cdc2d3c0e37946daeefc310a4b4c99deb3.tar.gz
skyhanni-d27553cdc2d3c0e37946daeefc310a4b4c99deb3.tar.bz2
skyhanni-d27553cdc2d3c0e37946daeefc310a4b4c99deb3.zip
Catch and log an error in GardenVisitorFeatures
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt12
1 files changed, 11 insertions, 1 deletions
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