diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt | 7 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt | 9 |
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) |