Fix Cryopod Runtime Error (#22492)

This is a fix for https://aurorastation.sentry.io/issues/7405385361 

Which I believe might actually also be one of the elusive "niche human
hard dels" that are so hard to track down since this runtime would also
prevent a key memory deallocation from occurring.
This commit is contained in:
VMSolidus
2026-05-27 15:42:01 +00:00
committed by GitHub
parent 29bc02f44e
commit 0593b47b29
2 changed files with 13 additions and 10 deletions
+9 -10
View File
@@ -122,10 +122,10 @@ SUBSYSTEM_DEF(jobs)
Debug("AR has failed, Player: [player], Rank: [rank]")
return FALSE
/datum/controller/subsystem/jobs/proc/FreeRole(var/rank)
var/datum/job/job = GetJob(rank)
if(!istype(job))
return
/datum/controller/subsystem/jobs/proc/FreeRole(rank)
astype(GetJob(rank), /datum/job)?.current_positions--
/datum/controller/subsystem/jobs/proc/FreeJob(datum/job/job)
job.current_positions--
/datum/controller/subsystem/jobs/proc/FindOccupationCandidates(datum/job/job, level, flag)
@@ -620,13 +620,12 @@ SUBSYSTEM_DEF(jobs)
//Handle job slot/tater cleanup.
if (H.mind)
var/role = H.mind.assigned_role
var/datum/job/job = GetJob(H.mind.assigned_role)
job.on_despawn(H)
FreeRole(role)
if(H.mind.objectives.len)
qdel(H.mind.objectives)
H.mind.special_role = null
if (job)
job.on_despawn(H)
FreeJob(job)
QDEL_LIST(H.mind.objectives)
H.mind.special_role = null
// Delete them from datacore.
if(ishuman(H))