- fixed ability to set 'max count' to 0 and screw up a custom counter

This commit is contained in:
Parnic
2010-10-16 03:55:46 +00:00
parent d315ee3e3c
commit c529fa5510

View File

@ -183,13 +183,14 @@ function IceCustomCount.prototype:GetOptions()
name = L["Maximum applications"], name = L["Maximum applications"],
desc = L["How many total applications of this buff/debuff can be applied. For example, only 5 sunders can ever be on a target, so this would be set to 5 for tracking Sunder.\n\nRemember to press ENTER after filling out this box with the name you want or it will not save."], desc = L["How many total applications of this buff/debuff can be applied. For example, only 5 sunders can ever be on a target, so this would be set to 5 for tracking Sunder.\n\nRemember to press ENTER after filling out this box with the name you want or it will not save."],
get = function() get = function()
return self.moduleSettings.maxCount return tostring(self.moduleSettings.maxCount)
end, end,
set = function(info, v) set = function(info, v)
if not v or not tonumber(v) then if not v or not tonumber(v) or tonumber(v) <= 0 then
v = 0 v = 5
end end
self.moduleSettings.maxCount = v self.moduleSettings.maxCount = tonumber(v)
self:CreateCustomFrame(true)
self:Redraw() self:Redraw()
end, end,
disabled = function() disabled = function()
@ -398,7 +399,13 @@ function IceCustomCount.prototype:Enable(core)
self.unit = self.moduleSettings.auraTarget self.unit = self.moduleSettings.auraTarget
if not tonumber(self.moduleSettings.maxCount) or tonumber(self.moduleSettings.maxCount) <= 0 then
self.moduleSettings.maxCount = 5
self:CreateCustomFrame(true) self:CreateCustomFrame(true)
self:Redraw()
else
self:CreateCustomFrame(true)
end
self:UpdateCustomCount() self:UpdateCustomCount()
end end