Fixed issue where Timer frame would refuse to close when 0 was given as time.
F16Gaming [11-21-11 - 01:17]
Fixed issue where Timer frame would refuse to close when 0 was given as time.
diff --git a/Timer.lua b/Timer.lua
index 662b55a..918a5c0 100644
--- a/Timer.lua
+++ b/Timer.lua
@@ -75,7 +75,7 @@ function T:Start(seconds, minutes, hours, callback, data)
if seconds <= 0 then
self.Running = false
KT:Msg("Time must be greater than zero.")
- return
+ return false
end
if type(callback) == "function" then
self:SetCallback(callback)
@@ -89,6 +89,7 @@ function T:Start(seconds, minutes, hours, callback, data)
self.Time.Stop = self.Time.Start + seconds
self:RunCallback(self:GetAllData(), self.State.START)
self.Frame:SetScript("OnUpdate", TimeCheck)
+ return true
end
function T:Stop()
diff --git a/TimerFrame.lua b/TimerFrame.lua
index 8526649..3613ef7 100644
--- a/TimerFrame.lua
+++ b/TimerFrame.lua
@@ -86,7 +86,10 @@ function TF:Start(s, m, h)
self.Running = true
self:InitializeControls()
KillTrackTimerFrame:Show()
- T:Start(s, m, h, function(d, u) TF:UpdateData(d, u) end, nil)
+ if not T:Start(s, m, h, function(d, u) TF:UpdateData(d, u) end, nil) then
+ self:Stop()
+ KillTrackTimerFrame:Hide()
+ end
end
function TF:Stop()