From 9adea37b6b26e6f46e34b44c7ad0c1d2f9c64da4 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Mon, 11 Jul 2022 04:13:44 +0200 Subject: [PATCH] [MIRROR] [s] Patches potential runtimes in AdminPM [MDB IGNORE] (#14845) * [s] Patches potential runtimes in AdminPM (#68324) About The Pull Request Hey there, 6e29689 seemed to work alright on my end, but apparently there are cases where current_ticket.id = NULL. This would cause runtime trace errors that would start to list out the first few words of most adminhelps. Fuck. You probably could use recipient.current_ticket.id on the "else" portion but I woke up to this and I'm not 100% certain if that will null out at this time. Might also be apt to revert #68215 entirely? Why It's Good For The Game Those shouldn't show up in runtimes! Changelog Nothing particularly player facing. * [s] Patches potential runtimes in AdminPM Co-authored-by: san7890 --- code/modules/admin/verbs/adminpm.dm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/code/modules/admin/verbs/adminpm.dm b/code/modules/admin/verbs/adminpm.dm index 1f3ab61a91a..a8bb7cb3b9e 100644 --- a/code/modules/admin/verbs/adminpm.dm +++ b/code/modules/admin/verbs/adminpm.dm @@ -310,7 +310,11 @@ current_ticket.MessageNoRecipient(msg) if(external) - log_admin_private("PM: Ticket #[current_ticket.id]: [key_name(src)]->External: [rawmsg]") + // Guard against the possibility of a null, since it'll runtime and spit out the contents of what should be a private ticket. + if(current_ticket) + log_admin_private("PM: Ticket #[current_ticket.id]: [key_name(src)]->External: [rawmsg]") + else + log_admin_private("PM: [key_name(src)]->External: [rawmsg]") for(var/client/X in GLOB.admins) to_chat(X, type = MESSAGE_TYPE_ADMINPM, @@ -318,7 +322,10 @@ confidential = TRUE) else window_flash(recipient, ignorepref = TRUE) - log_admin_private("PM: Ticket #[current_ticket.id]: [key_name(src)]->[key_name(recipient)]: [rawmsg]") + if(current_ticket) + log_admin_private("PM: Ticket #[current_ticket.id]: [key_name(src)]->[key_name(recipient)]: [rawmsg]") + else + log_admin_private("PM: [key_name(src)]->[key_name(recipient)]: [rawmsg]") //we don't use message_admins here because the sender/receiver might get it too for(var/client/X in GLOB.admins) if(X.key!=key && X.key!=recipient.key) //check client/X is an admin and isn't the sender or recipient