From 16a26805126fdb7bb6352088f579fd2e839480db Mon Sep 17 00:00:00 2001 From: Shadowlight213 Date: Sun, 4 Sep 2016 18:39:00 -0700 Subject: [PATCH] Makes the tgui subsystem clean up empty lists on ui closing --- code/modules/tgui/subsystem.dm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/code/modules/tgui/subsystem.dm b/code/modules/tgui/subsystem.dm index 81c67c67d1c..c623e3c39ae 100644 --- a/code/modules/tgui/subsystem.dm +++ b/code/modules/tgui/subsystem.dm @@ -182,8 +182,15 @@ processing_uis.Remove(ui) // Remove it from the list of processing UIs. if(ui.user) // If the user exists, remove it from them too. ui.user.open_uis.Remove(ui) - var/list/uis = open_uis[src_object_key][ui.ui_key] // Remove it from the list of open UIs. + var/Ukey = ui.ui_key + var/list/uis = open_uis[src_object_key][Ukey] // Remove it from the list of open UIs. uis.Remove(ui) + if(!uis.len) + var/list/uiobj = open_uis[src_object_key] + uiobj.Remove(Ukey) + if(!uiobj.len) + open_uis.Remove(src_object_key) + return 1 // Let the caller know we did it. /**