diff --git a/code/modules/client/client defines.dm b/code/modules/client/client defines.dm index 0a0810a54a..b6b8d1b14d 100644 --- a/code/modules/client/client defines.dm +++ b/code/modules/client/client defines.dm @@ -53,8 +53,8 @@ var/related_accounts_cid = "(Requires database)" //So admins know why it isn't working - Used to determine what other accounts previously logged in from this computer id var/account_join_date = "(Requires database)" var/account_age = "(Requires database)" - var/list/department_hours // VOREStation Edit - Track hours of leave accured for each department. - var/list/play_hours // VOREStation Edit - Tracks total playtime hours for each departments. + var/list/department_hours = list() // VOREStation Edit - Track hours of leave accured for each department. + var/list/play_hours = list() // VOREStation Edit - Tracks total playtime hours for each departments. preload_rsc = PRELOAD_RSC diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 335e74e9e3..36f11e736f 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -359,14 +359,16 @@ log_admin("Couldn't perform IP check on [key] with [address]") // VOREStation Edit Start - Department Hours - if(config.time_off) - var/DBQuery/query_hours = dbcon.NewQuery("SELECT department, hours, total_hours FROM vr_player_hours WHERE ckey = '[sql_ckey]'") - query_hours.Execute() - LAZYINITLIST(department_hours) - LAZYINITLIST(play_hours) + var/DBQuery/query_hours = dbcon.NewQuery("SELECT department, hours, total_hours FROM vr_player_hours WHERE ckey = '[sql_ckey]'") + if(query_hours.Execute()) while(query_hours.NextRow()) department_hours[query_hours.item[1]] = text2num(query_hours.item[2]) play_hours[query_hours.item[1]] = text2num(query_hours.item[3]) + else + var/error_message = query_hours.ErrorMsg() // Need this out here since the spawn below will split the stack and who knows what'll happen by the time it runs + log_debug("Error loading play hours for [ckey]: [error_message]") + spawn(0) + alert(src, "The query to load your existing playtime failed. Screenshot this, give the screenshot to a developer, and reconnect, otherwise you may lose any recorded play hours (which may limit access to jobs). ERROR: [error_message]", "PROBLEMS!!") // VOREStation Edit End - Department Hours if(sql_id)