Skip to content

Commit

Permalink
prevent divide by zero if user has reset all softcore achievements fo…
Browse files Browse the repository at this point in the history
…r a set, but no hardcore achievements (#1182)
  • Loading branch information
Jamiras authored Oct 7, 2022
1 parent 93c49e1 commit 7952fe5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/render/game.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@ function RenderGameProgress(int $numAchievements, int $numEarnedCasual, int $num
$pctHardcoreProportion = 0;
$title = '';

if ($numEarnedCasual < 0) {
$numEarnedCasual = 0;
}

if ($numAchievements) {
$pctAwardedCasual = ($numEarnedCasual + $numEarnedHardcore) / $numAchievements;
$pctAwardedHardcore = $numEarnedHardcore / $numAchievements;
Expand Down

0 comments on commit 7952fe5

Please sign in to comment.