Skip to content

Commit

Permalink
groups.cpp: Prevent divide-by-zero
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Sep 19, 2023
1 parent 21db14c commit 1efb8b5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hci/groups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1efb8b5

Please sign in to comment.