From 2ca26b1ea05e11a8aab6e89fe6a3ac3cd8c31723 Mon Sep 17 00:00:00 2001 From: Steve Date: Thu, 3 Mar 2016 07:47:33 +0000 Subject: [PATCH] Divide by zero check. --- src/system/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/util.c b/src/system/util.c index 6444b7d..d315a2f 100644 --- a/src/system/util.c +++ b/src/system/util.c @@ -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)