mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2024-12-25 21:59:30 +01:00
XmlWriter: avoid a division by zero
This commit is contained in:
parent
8437316c36
commit
cd34ce6d32
1 changed files with 3 additions and 1 deletions
|
@ -344,7 +344,9 @@ void XmlWriter::write(const Game &iGame, const string &iFileName)
|
||||||
const int playerTotal = player.getTotalScore();
|
const int playerTotal = player.getTotalScore();
|
||||||
|
|
||||||
// Compute the percentage, compared to the top
|
// Compute the percentage, compared to the top
|
||||||
long int percentage = lround((double)100 * playerTotal / gameTotal);
|
long int percentage = 0;
|
||||||
|
if (gameTotal != 0)
|
||||||
|
percentage = lround((double)100 * playerTotal / gameTotal);
|
||||||
|
|
||||||
// Compute the rank of the player (naive algorithm)
|
// Compute the rank of the player (naive algorithm)
|
||||||
int rank = 1;
|
int rank = 1;
|
||||||
|
|
Loading…
Reference in a new issue