aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-19 20:47:37 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-19 20:47:37 +0100
commit2703e2a471ecf6e732e330430663cc3421999afa (patch)
treeda69a793edd43b5a1736adc86b2c2f82effebff8 /src/main/java
parent64c445caf5903e8a992651322d998c690507236f (diff)
downloadskyhanni-2703e2a471ecf6e732e330430663cc3421999afa.tar.gz
skyhanni-2703e2a471ecf6e732e330430663cc3421999afa.tar.bz2
skyhanni-2703e2a471ecf6e732e330430663cc3421999afa.zip
Added a workaround to temporarily fix crashes when holding a hoe. Added debug information to fix this bug in the future for real
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt9
2 files changed, 14 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt
index a0a58ffb2..893c65645 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt
@@ -108,7 +108,12 @@ class CropMoneyDisplay {
for ((internalName, amount) in multipliers) {
val price = NEUItems.getPrice(internalName)
val cropName = cropNames[internalName]!!
- val speed = GardenAPI.getCropsPerSecond(cropName)!!
+ val speed = GardenAPI.getCropsPerSecond(cropName)
+ if (speed == null) {
+ println("calculateMoneyPerHour: Speed is null for crop name '$cropName' ($internalName)")
+ LorenzUtils.debug("calculateMoneyPerHour: Speed is null!")
+ continue
+ }
// No speed data for item in hand
if (speed == -1) continue
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt
index c4e8bf484..1faa8e3e7 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt
@@ -82,7 +82,14 @@ class GardenCropMilestoneDisplay {
if (cultivatingData.containsKey(crop)) {
val old = cultivatingData[crop]!!
val diff = counter - old
- GardenCropMilestones.cropCounter[crop] = GardenCropMilestones.cropCounter[crop]!! + diff
+ try {
+ GardenCropMilestones.cropCounter[crop] = GardenCropMilestones.cropCounter[crop]!! + diff
+ } catch (e: NullPointerException) {
+ println("crop: '$crop'")
+ println("GardenCropMilestones.cropCounter: '${GardenCropMilestones.cropCounter.keys}'")
+ LorenzUtils.debug("NPE at OwnInventorItemUpdateEvent with GardenCropMilestones.cropCounter")
+ e.printStackTrace()
+ }
EliteFarmingWeight.addCrop(crop, diff)
if (currentCrop == crop) {
calculateSpeed(diff)