diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index bcc49010377..dc29f7ee9fd 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -240,6 +240,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list( throw_icon = null resist_icon = null QDEL_LIST(infodisplay) + open_containers = null healths = null stamina = null diff --git a/code/datums/storage/storage.dm b/code/datums/storage/storage.dm index f9ca006c9a4..ef525effb3d 100644 --- a/code/datums/storage/storage.dm +++ b/code/datums/storage/storage.dm @@ -701,9 +701,11 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches) SIGNAL_HANDLER for(var/mob/user as anything in is_using) - if(user.client) - var/client/cuser = user.client - cuser.screen -= gone + user.hud_used?.open_containers -= gone + if(!user.client) + continue + var/client/cuser = user.client + cuser.screen -= gone reset_item(gone) refresh_views() @@ -1082,10 +1084,11 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches) is_using -= to_hide if(to_hide.client) - to_hide.hud_used.open_containers -= storage_interfaces[to_hide].list_ui_elements() to_hide.client.screen -= storage_interfaces[to_hide].list_ui_elements() - to_hide.hud_used.open_containers -= real_location.contents to_hide.client.screen -= real_location.contents + if(to_hide.hud_used) + to_hide.hud_used.open_containers -= storage_interfaces[to_hide].list_ui_elements() + to_hide.hud_used.open_containers -= real_location.contents QDEL_NULL(storage_interfaces[to_hide]) storage_interfaces -= to_hide