mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-01 04:01:56 +02:00
Fix divide-by-zero error
... when displaying save buttons that have zero votes.
This commit is contained in:
@@ -68,6 +68,8 @@ SaveButton::SaveButton(Point position, Point size, SaveInfo * save):
|
||||
votesString = votes;
|
||||
|
||||
int voteMax = std::max(save->GetVotesUp(),save->GetVotesDown());
|
||||
if (voteMax)
|
||||
{
|
||||
if (voteMax < 34)
|
||||
{
|
||||
float ry = 33.0f/voteMax;
|
||||
@@ -83,6 +85,12 @@ SaveButton::SaveButton(Point position, Point size, SaveInfo * save):
|
||||
voteBarHeightDown = (int)(save->GetVotesDown()/ry)-1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
voteBarHeightUp = 0;
|
||||
voteBarHeightDown = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SaveButton::SaveButton(Point position, Point size, SaveFile * file):
|
||||
|
Reference in New Issue
Block a user