From 0593b47b29b9c0be60893f1b2e0c2fe79c58d5c3 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Wed, 27 May 2026 11:42:01 -0400 Subject: [PATCH] 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. --- code/controllers/subsystems/job.dm | 19 +++++++++---------- .../hellfirejag-null-ondespawn-fix.yml | 4 ++++ 2 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 html/changelogs/hellfirejag-null-ondespawn-fix.yml diff --git a/code/controllers/subsystems/job.dm b/code/controllers/subsystems/job.dm index 1f6eaa2ffb3..ae9441b7b63 100644 --- a/code/controllers/subsystems/job.dm +++ b/code/controllers/subsystems/job.dm @@ -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)) diff --git a/html/changelogs/hellfirejag-null-ondespawn-fix.yml b/html/changelogs/hellfirejag-null-ondespawn-fix.yml new file mode 100644 index 00000000000..29bd60e5b55 --- /dev/null +++ b/html/changelogs/hellfirejag-null-ondespawn-fix.yml @@ -0,0 +1,4 @@ +author: Hellfirejag +delete-after: True +changes: + - bugfix: "Fixed a runtime error that occurs sometimes when a character despawns via cryopod."