FindOccupationCandidates will no longer die if the client disappears halfway through the proc. (#62819)

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
This commit is contained in:
Iamgoofball
2021-11-16 12:09:18 -08:00
committed by GitHub
co-authored by Mothblocks
parent a41c00426d
commit 626dd9b87b
+7 -1
View File
@@ -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