1
0
Fork 0

Prevent LUA error from displaying when calendar hasn't been opened yet while debugging.

This commit is contained in:
Andrew Tomaka 2011-08-31 03:30:12 -04:00
parent 6f02e8a50d
commit af150e321f
1 changed files with 13 additions and 6 deletions

View File

@ -202,7 +202,8 @@ end
function core:GetNextVPReset()
--prepare calendar
local currentCalendarSetting = GetCVar('calendarShowResets') -- get current value and store
SetCVar('calendarShowResets',1) -- set it to what we want
SetCVar('calendarShowResets', 1) -- set it to what we want
OpenCalendar()
--figure out what time the server resets daily information
local questReset = GetQuestResetTime()
@ -211,6 +212,8 @@ function core:GetNextVPReset()
--figure out reset day using next BH lockout
local _, month, day, year = CalendarGetDate()
--calendar not yet loaded? Cannot find events when first fires of this;
--"arbitrarily" fires at unknown time.
local monthOffset = 0
local resetDate = nil
while resetDate == nil do
@ -240,9 +243,13 @@ function core:GetNextVPReset()
SetCVar('calendarShowResets',currentCalendarSetting)
--and combine for the reset timestamp
resetDate.hour = resetTime.hour
resetDate.min = resetTime.min
resetDate.sec = resetTime.sec
return time(resetDate)
if(resetDate ~= nil) then
resetDate.hour = resetTime.hour
resetDate.min = resetTime.min
resetDate.sec = resetTime.sec
return time(resetDate)
else
print('resetDate not set')
end
end