Fix crash when rollDice is called with 0.

This commit is contained in:
Evgeny Kurnevsky 2018-04-21 16:27:07 +03:00
parent 1f1f47431f
commit 48fb6bb9e8
No known key found for this signature in database
GPG key ID: 8FF444E5412D750C

View file

@ -25,7 +25,7 @@ namespace Misc
int Rng::rollDice(int max)
{
return std::uniform_int_distribution<int>(0, max - 1)(generator);
return max > 0 ? std::uniform_int_distribution<int>(0, max - 1)(generator) : 0;
}
}