Defend against divide by 0.

This commit is contained in:
Steve 2018-03-04 17:03:11 +00:00
parent 924978c2a0
commit 83e7276fa9
1 changed files with 1 additions and 1 deletions

View File

@ -43,7 +43,7 @@ double randF(void)
int getPercent(float current, float total) int getPercent(float current, float total)
{ {
return (current / total) * 100; return total > 0 ? (current / total) * 100 : 0;
} }
float limit(float i, float a, float b) float limit(float i, float a, float b)