diff --git a/code/datums/storage/storage.dm b/code/datums/storage/storage.dm index 465a93a4c06..feda199d670 100644 --- a/code/datums/storage/storage.dm +++ b/code/datums/storage/storage.dm @@ -974,7 +974,7 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches) if(user.active_storage == src && user.client) seeing += user else - is_using -= user + hide_contents(user) return seeing /** @@ -1032,8 +1032,6 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches) * * mob/to_hide - the mob to hide the storage from */ /datum/storage/proc/hide_contents(mob/to_hide) - if(!to_hide.client) - return TRUE if(to_hide.active_storage == src) to_hide.active_storage = null @@ -1046,8 +1044,9 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches) is_using -= to_hide - to_hide.client.screen -= storage_interfaces[to_hide].list_ui_elements() - to_hide.client.screen -= real_location.contents + if(to_hide.client) + to_hide.client.screen -= storage_interfaces[to_hide].list_ui_elements() + to_hide.client.screen -= real_location.contents QDEL_NULL(storage_interfaces[to_hide]) storage_interfaces -= to_hide @@ -1078,7 +1077,9 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches) var/columns = clamp(max_slots, 1, screen_max_columns) var/rows = clamp(CEILING(adjusted_contents / columns, 1) + additional_row, 1, screen_max_rows) - for (var/ui_user in storage_interfaces) + for (var/mob/ui_user as anything in storage_interfaces) + if (isnull(storage_interfaces[ui_user])) + continue storage_interfaces[ui_user].update_position(screen_start_x, screen_pixel_x, screen_start_y, screen_pixel_y, columns, rows) var/current_x = screen_start_x