From 84577ae5e9f09da87651a17d47dbc705d337286a Mon Sep 17 00:00:00 2001 From: Parnic Date: Sun, 22 Mar 2015 21:44:23 -0500 Subject: [PATCH] Fixed potential divide-by-zero in the custom counter module. --- modules/CustomCount.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/CustomCount.lua b/modules/CustomCount.lua index d852c25..b10a030 100644 --- a/modules/CustomCount.lua +++ b/modules/CustomCount.lua @@ -548,9 +548,10 @@ function IceCustomCount.prototype:SetCustomColor() end function IceCustomCount.prototype:GetGradientColor(curr) + local max = self:GetMaxCount() local r, g, b = self:GetCustomColor() local mr, mg, mb = self:GetCustomMinColor() - local scale = (curr-1)/(self:GetMaxCount()-1) + local scale = max > 1 and ((curr-1)/(max-1)) or 1 r = r * scale + mr * (1-scale) g = g * scale + mg * (1-scale)