Skip to content

Commit

Permalink
[MIRROR] Fixes CI runtime/race condition with forensics (#2092)
Browse files Browse the repository at this point in the history
* Fixes CI runtime/race condition with forensics (#81610)

## About The Pull Request

Just a quick fix for the following CI runtime, and additionally passes
through the rest of this file's weakref instances for any other
potential bugs.


![image](https://github.com/tgstation/tgstation/assets/13398309/a58be18a-21e4-40b2-92e0-1a961108c939)

## Why It's Good For The Game

Bugfix

## Changelog

Nothing player facing

---------



* Fixes CI runtime/race condition with forensics

---------

Co-authored-by: NovaBot <[email protected]>
Co-authored-by: Bloop <[email protected]>
Co-authored-by: san7890 <[email protected]>
  • Loading branch information
4 people authored Feb 24, 2024
1 parent 2834330 commit 3bb5f91
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions code/modules/forensics/_forensics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
var/atom/parent_atom = parent.resolve()
if (!isnull(parent_atom))
UnregisterSignal(parent_atom, list(COMSIG_COMPONENT_CLEAN_ACT))
parent = null
return ..()

/// Empties the fingerprints list
Expand Down Expand Up @@ -147,7 +148,9 @@
/// Adds a single fiber
/datum/forensics/proc/add_fibers(mob/living/carbon/human/suspect)
var/fibertext
var/atom/actual_parent = parent.resolve()
var/atom/actual_parent = parent?.resolve()
if(isnull(actual_parent))
parent = null
var/item_multiplier = isitem(actual_parent) ? ITEM_FIBER_MULTIPLIER : NON_ITEM_FIBER_MULTIPLIER
if(suspect.wear_suit)
fibertext = "Material from \a [suspect.wear_suit]."
Expand Down Expand Up @@ -214,8 +217,11 @@
if(last_stamp_pos)
LAZYSET(hiddenprints, suspect.key, copytext(hiddenprints[suspect.key], 1, last_stamp_pos))
hiddenprints[suspect.key] += "\nLast: \[[current_time]\] \"[suspect.real_name]\"[has_gloves]. Ckey: [suspect.ckey]" //made sure to be existing by if(!LAZYACCESS);else
var/atom/parent_atom = parent.resolve()
parent_atom.fingerprintslast = suspect.ckey
var/atom/parent_atom = parent?.resolve()
if(!isnull(parent_atom))
parent_atom.fingerprintslast = suspect.ckey
else
parent = null
return TRUE

/// Adds the given list into blood_DNA
Expand All @@ -230,7 +236,10 @@

/// Updates the blood displayed on parent
/datum/forensics/proc/check_blood()
var/obj/item/the_thing = parent.resolve()
var/obj/item/the_thing = parent?.resolve()
if(isnull(the_thing))
parent = null
return
if(!istype(the_thing) || isorgan(the_thing)) // organs don't spawn with blood decals by default
return
if(!length(blood_DNA))
Expand Down

0 comments on commit 3bb5f91

Please sign in to comment.