From d51083913f37fc7f6da5efce9dca18bf37e1e9c3 Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Fri, 25 Jun 2021 17:08:03 -0400 Subject: [PATCH] Fix tg bug, safety https://github.com/tgstation/tgstation/pull/59822 --- code/modules/tgui/tgui_alert.dm | 14 +++++++++++++- code/modules/tgui/tgui_input_list.dm | 6 ++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/code/modules/tgui/tgui_alert.dm b/code/modules/tgui/tgui_alert.dm index dc309cbe2b3..a9d87e14005 100644 --- a/code/modules/tgui/tgui_alert.dm +++ b/code/modules/tgui/tgui_alert.dm @@ -10,6 +10,12 @@ * * timeout - The timeout of the alert, after which the modal will close and qdel itself. Set to zero for no timeout. */ /proc/tgui_alert(mob/user, message = null, title = null, list/buttons = list("Ok"), timeout = 0) + if (istext(buttons)) + stack_trace("tgui_alert() received text for buttons instead of list") + return + if (istext(user)) + stack_trace("tgui_alert() received text for user instead of list") + return if (!user) user = usr if (!istype(user)) @@ -38,6 +44,12 @@ * * timeout - The timeout of the alert, after which the modal will close and qdel itself. Disabled by default, can be set to seconds otherwise. */ /proc/tgui_alert_async(mob/user, message = null, title = null, list/buttons = list("Ok"), datum/callback/callback, timeout = 0) + if (istext(buttons)) + stack_trace("tgui_alert() received text for buttons instead of list") + return + if (istext(user)) + stack_trace("tgui_alert() received text for user instead of list") + return if (!user) user = usr if (!istype(user)) @@ -138,7 +150,7 @@ var/datum/callback/callback /datum/tgui_modal/async/New(mob/user, message, title, list/buttons, callback, timeout) - ..(user, title, message, buttons, timeout) + ..(user, message, title, buttons, timeout) src.callback = callback /datum/tgui_modal/async/Destroy(force, ...) diff --git a/code/modules/tgui/tgui_input_list.dm b/code/modules/tgui/tgui_input_list.dm index 906f37f2422..9c27467d25b 100644 --- a/code/modules/tgui/tgui_input_list.dm +++ b/code/modules/tgui/tgui_input_list.dm @@ -10,6 +10,9 @@ * * timeout - The timeout of the input box, after which the input box will close and qdel itself. Set to zero for no timeout. */ /proc/tgui_input_list(mob/user, message, title, list/buttons, timeout = 0) + if (istext(user)) + stack_trace("tgui_alert() received text for user instead of list") + return if (!user) user = usr if(!length(buttons)) @@ -40,6 +43,9 @@ * * timeout - The timeout of the input box, after which the menu will close and qdel itself. Set to zero for no timeout. */ /proc/tgui_input_list_async(mob/user, message, title, list/buttons, datum/callback/callback, timeout = 60 SECONDS) + if (istext(user)) + stack_trace("tgui_alert() received text for user instead of list") + return if (!user) user = usr if(!length(buttons))