From c9e60e63d5b20f26c2d6b1edf7358e148a620048 Mon Sep 17 00:00:00 2001 From: nicetoolbox Date: Fri, 2 Oct 2020 01:25:15 -0700 Subject: [PATCH] validate menus and categories on setCategory action --- code/modules/research/rdconsole.dm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/code/modules/research/rdconsole.dm b/code/modules/research/rdconsole.dm index a739db8e13e..727271749e6 100644 --- a/code/modules/research/rdconsole.dm +++ b/code/modules/research/rdconsole.dm @@ -249,12 +249,21 @@ won't update every console in existence) but it's more of a hassle to do. Also, var/next_category = params["category"] var/compare - matching_designs.Cut() + if(submenu != SUBMENU_MAIN) + return FALSE if(menu == MENU_LATHE) compare = PROTOLATHE - else + if(!linked_lathe || !(next_category in linked_lathe.categories)) + return FALSE + else if(menu == MENU_IMPRINTER) compare = IMPRINTER + if(!linked_imprinter || !(next_category in linked_imprinter.categories)) + return FALSE + else + return FALSE + + matching_designs.Cut() for(var/v in files.known_designs) var/datum/design/D = files.known_designs[v]