diff --git a/code/modules/admin/verbs/adminpm.dm b/code/modules/admin/verbs/adminpm.dm
index 86556ffa3f1..4bc5cebb212 100644
--- a/code/modules/admin/verbs/adminpm.dm
+++ b/code/modules/admin/verbs/adminpm.dm
@@ -58,6 +58,14 @@
if (!msg)
message_admins("[key_name_admin(src)] has cancelled their reply to [key_name_admin(C, 0, 0)]'s admin help.")
return
+ if(!C) //We lost the client during input, disconnected or relogged.
+ if(GLOB.directory[AH.initiator_ckey]) // Client has reconnected, lets try to recover
+ whom = GLOB.directory[AH.initiator_ckey]
+ else
+ to_chat(src, "Error: Admin-PM: Client not found.", confidential = TRUE)
+ to_chat(src, "Message not sent:
[msg]", confidential = TRUE)
+ AH.AddInteraction("No client found, message not sent:
[msg]")
+ return
cmd_admin_pm(whom, msg)
//takes input from cmd_admin_pm_context, cmd_admin_pm_panel or /client/Topic and sends them a PM.
@@ -86,6 +94,10 @@
else if(istype(whom, /client))
recipient = whom
+ if(!recipient)
+ to_chat(src, "Error: Admin-PM: Client not found.", confidential = TRUE)
+ return
+
recipient_ckey = recipient.ckey
recipient_ticket = recipient.current_ticket
@@ -116,9 +128,9 @@
else
if(holder)
to_chat(src, "Error: Admin-PM: Client not found.", confidential = TRUE)
- to_chat(src, msg, confidential = TRUE)
+ to_chat(src, "Message not sent:
[msg]", confidential = TRUE)
if(recipient_ticket)
- recipient_ticket.AddInteraction("No client found, message not sent:
[msg]")
+ recipient_ticket.AddInteraction("No client found, message not sent:
[msg]")
return
else
current_ticket.MessageNoRecipient(msg)