From 73f2a917fa822f176ab34eb2e6ab38d5b2584e9e Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 17 Jun 2024 00:43:08 +0200 Subject: added more debug into for farming weight duration NaN error --- .../features/garden/farming/FarmingWeightDisplay.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt index 9d09880e3..535163f81 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt @@ -309,7 +309,19 @@ object FarmingWeightDisplay { } val timeFormat = if (weightPerSecond != -1.0) { - val timeTillOvertake = (weightUntilOvertake / weightPerSecond).minutes + val timeTillOvertake = try { + (weightUntilOvertake / weightPerSecond).minutes + } catch (e: Exception) { + ErrorManager.logErrorWithData( + e, + "Error calculating Farming ETA duration", + "weightPerSecond" to weightPerSecond, + "weightUntilOvertake" to weightUntilOvertake, + "totalWeight" to totalWeight, + "nextPlayer.weight" to nextPlayer.weight, + ) + return null + } val format = timeTillOvertake.format() " §7(§b$format§7)" } else "" -- cgit