Divide by zero check.

This commit is contained in:
Steve 2016-03-03 07:47:33 +00:00
parent 263a6cc5b5
commit 2ca26b1ea0
1 changed files with 1 additions and 1 deletions

View File

@ -32,7 +32,7 @@ int rrnd(int low, int high)
int getPercent(float current, float total)
{
return (current / total) * 100;
return total != 0 ? (current / total) * 100 : 0;
}
int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2)