From 1efb8b556b22882c18c63f1d8cf4304e0b98f814 Mon Sep 17 00:00:00 2001 From: past-due <30942300+past-due@users.noreply.github.com> Date: Tue, 19 Sep 2023 11:30:25 -0400 Subject: [PATCH] groups.cpp: Prevent divide-by-zero --- src/hci/groups.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hci/groups.cpp b/src/hci/groups.cpp index 2dde10320fd..f8aee44f43e 100644 --- a/src/hci/groups.cpp +++ b/src/hci/groups.cpp @@ -218,7 +218,7 @@ class GroupButton : public DynamicIntFancyButton #define MAX_DAMAGE_GLOW_ALPHA 100 inline uint8_t accumulatedDamageToTargetGlowAlpha(uint64_t accumulatedDamage, uint64_t totalGroupMaxHealth, uint64_t unitsKilled) { - uint64_t damageVisualPercent = (accumulatedDamage * 100) / totalGroupMaxHealth; + uint64_t damageVisualPercent = (totalGroupMaxHealth > 0) ? ((accumulatedDamage * 100) / totalGroupMaxHealth) : 0; if (unitsKilled > 0) { damageVisualPercent = 100;