diff --git a/code/datums/mind.dm b/code/datums/mind.dm index dfc3fab8673..69cc543515c 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -76,7 +76,7 @@ /datum/mind/Destroy() SSticker.minds -= src - QDEL_LIST(antag_datums) + remove_all_antag_datums() current = null return ..() @@ -1541,14 +1541,20 @@ */ /datum/mind/proc/remove_antag_datum(datum_type) var/datum/antagonist/A = has_antag_datum(datum_type) - LAZYREMOVE(antag_datums, A) qdel(A) /** * Removes all antag datums from the src mind. + * + * Use this over doing `QDEL_LIST(antag_datums)`. */ -/datum/mind/proc/remove_all_antag_datums() //For the Lazy amongst us. - QDEL_LIST(antag_datums) +/datum/mind/proc/remove_all_antag_datums() + // This is not `QDEL_LIST(antag_datums)`because it's possible for the `antag_datums` list to be set to null during deletion of an antag datum. + // Then `QDEL_LIST` would runtime because it would be doing `null.Cut()`. + for(var/datum/antagonist/A as anything in antag_datums) + qdel(A) + antag_datums?.Cut() + antag_datums = null /// This proc sets the hijack speed for a mob. If greater than zero, they can hijack. Outputs in seconds. /datum/mind/proc/get_hijack_speed() diff --git a/code/modules/antagonists/traitor/datum_traitor.dm b/code/modules/antagonists/traitor/datum_traitor.dm index 84f82f82f76..6e1dd0f615a 100644 --- a/code/modules/antagonists/traitor/datum_traitor.dm +++ b/code/modules/antagonists/traitor/datum_traitor.dm @@ -44,7 +44,7 @@ slaved.leave_serv_hud(owner) owner.som = null - owner.current.client.chatOutput?.clear_syndicate_codes() + owner.current.client?.chatOutput?.clear_syndicate_codes() // Try removing their uplink, check PDA var/mob/M = owner.current