From ed128da70b21e9453d57c84fe14eb7571e4c1d7d Mon Sep 17 00:00:00 2001 From: F16Gaming Date: Mon, 21 Nov 2011 02:17:17 +0100 Subject: [PATCH] Fixed issue where Timer frame would refuse to close when 0 was given as time. --- Timer.lua | 3 ++- TimerFrame.lua | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) 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() -- 1.7.9.5