mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 21:18:37 +01:00
Fix forensic component inheritance inserting null entries into lists and causing to_chat errors. (#59873)
Fixing the following runtime:
[17:13:04] Runtime in to_chat.dm,88: Empty or null string in to_chat proc call.
proc name: to chat (/proc/to_chat)
usr: Cowboy_penis_monster/(Zackary Mason)
usr.loc: (Telecomms Control Room (105,89,2))
src: null
call stack:
to chat(Zackary Mason (/mob/living/carbon/human), "", null, "", 0, 1, 1, 0)
the forensic scanner (/obj/item/detective_scanner): add log("", 1)
the forensic scanner (/obj/item/detective_scanner): scan(Control Room (/obj/machinery/door/airlock/command/glass), Zackary Mason (/mob/living/carbon/human))
Forensic scanner attempting to add "" to the logs, which eventually gets output to_chat.
Tracked error down to forensic component lazylists and the fun of trying to OR two lazylists together.
This commit is contained in:
@@ -571,3 +571,13 @@
|
||||
return FALSE
|
||||
|
||||
return TRUE
|
||||
|
||||
#define LAZY_LISTS_OR(left_list, right_list)\
|
||||
( length(left_list)\
|
||||
? length(right_list)\
|
||||
? (left_list | right_list)\
|
||||
: left_list.Copy()\
|
||||
: length(right_list)\
|
||||
? right_list.Copy()\
|
||||
: null\
|
||||
)
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
var/list/fibers //assoc print = print
|
||||
|
||||
/datum/component/forensics/InheritComponent(datum/component/forensics/F, original) //Use of | and |= being different here is INTENTIONAL.
|
||||
fingerprints = fingerprints | F.fingerprints
|
||||
hiddenprints = hiddenprints | F.hiddenprints
|
||||
blood_DNA = blood_DNA | F.blood_DNA
|
||||
fibers = fibers | F.fibers
|
||||
fingerprints = LAZY_LISTS_OR(fingerprints, F.fingerprints)
|
||||
hiddenprints = LAZY_LISTS_OR(hiddenprints, F.hiddenprints)
|
||||
blood_DNA = LAZY_LISTS_OR(blood_DNA, F.blood_DNA)
|
||||
fibers = LAZY_LISTS_OR(fibers, F.fibers)
|
||||
check_blood()
|
||||
return ..()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user