Fix possible division by zero

This commit is contained in:
Benau 2019-04-15 11:20:25 +08:00
parent 49e6bda418
commit aecee4c781

View File

@ -716,6 +716,10 @@ void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin)
num_karts = World::getWorld()->getCurrentNumKarts();
else
num_karts = race_manager->getNumberOfKarts() - sta;
// May happen in spectate mode if all players disconnected before server
// reset
if (num_karts == 0)
return;
// -2 because that's the spacing further on
int ICON_PLAYER_WIDTH = y_space / (num_karts) - 2;