From 626dd9b87b453830b82da4848a3e19dfda9f7139 Mon Sep 17 00:00:00 2001 From: Iamgoofball Date: Tue, 16 Nov 2021 12:09:18 -0800 Subject: [PATCH] FindOccupationCandidates will no longer die if the client disappears halfway through the proc. (#62819) Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com> --- code/controllers/subsystem/job.dm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm index 942c02af020..dbdfaff1d6e 100644 --- a/code/controllers/subsystem/job.dm +++ b/code/controllers/subsystem/job.dm @@ -214,8 +214,14 @@ SUBSYSTEM_DEF(job) JobDebug("Running FOC, Job: [job], Level: [job_priority_level_to_string(level)]") var/list/candidates = list() for(var/mob/dead/new_player/player in unassigned) + if(!player) + JobDebug("FOC player no longer exists.") + continue + if(!player.client) + JobDebug("FOC player client no longer exists, Player: [player]") + continue // Initial screening check. Does the player even have the job enabled, if they do - Is it at the correct priority level? - var/player_job_level = player.client.prefs.job_preferences[job.title] + var/player_job_level = player.client?.prefs.job_preferences[job.title] if(isnull(player_job_level)) JobDebug("FOC player job not enabled, Player: [player]") continue