From 3d5be6b2c0a0b629635780d41af875e3e291d556 Mon Sep 17 00:00:00 2001 From: adpist Date: Sun, 12 Oct 2025 13:01:07 +0200 Subject: [PATCH] Safeguard from divide by 0 on replenish stat computation --- pkg/memory/game_reader.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/memory/game_reader.go b/pkg/memory/game_reader.go index 859228c..c132e8f 100644 --- a/pkg/memory/game_reader.go +++ b/pkg/memory/game_reader.go @@ -246,7 +246,9 @@ func (gd *GameReader) getStatsList(statListPtr uintptr) stat.Stats { stat.ManaPerLevel: value = int(math.Max(float64(statValue/2048), 1)) case stat.ReplenishDurability, stat.ReplenishQuantity: - value = int(math.Max(float64(2/statValue), 1)) + if statValue > 0 { + value = int(math.Max(float64(2/statValue), 1)) + } case stat.RegenStaminaPerLevel: value = int(statValue) * 10