diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm index 2f2f4f2d238..11b20cfb210 100644 --- a/code/__HELPERS/icons.dm +++ b/code/__HELPERS/icons.dm @@ -1335,9 +1335,11 @@ GLOBAL_LIST_EMPTY(transformation_animation_objects) /// Strips all underlays on a different plane from an appearance. /// Returns the stripped appearance. -/proc/strip_appearance_underlays(mutable_appearance/appearance) +/proc/strip_appearance_underlays(mutable_appearance/appearance) as /mutable_appearance var/base_plane = PLANE_TO_TRUE(appearance.plane) for(var/mutable_appearance/underlay as anything in appearance.underlays) + if(isnull(underlay)) + continue if(PLANE_TO_TRUE(underlay.plane) != base_plane) appearance.underlays -= underlay return appearance @@ -1348,13 +1350,15 @@ GLOBAL_LIST_EMPTY(transformation_animation_objects) * Filters out certain overlays from the copy, depending on their planes * Prevents stuff like lighting from being copied to the new appearance */ -/proc/copy_appearance_filter_overlays(appearance_to_copy) +/proc/copy_appearance_filter_overlays(appearance_to_copy) as /mutable_appearance var/mutable_appearance/copy = new(appearance_to_copy) var/static/list/plane_whitelist = list(FLOAT_PLANE, GAME_PLANE, FLOOR_PLANE) /// Ideally we'd have knowledge what we're removing but i'd have to be done on target appearance retrieval var/list/overlays_to_keep = list() for(var/mutable_appearance/special_overlay as anything in copy.overlays) + if(isnull(special_overlay)) + continue var/mutable_appearance/real = new() real.appearance = special_overlay if(PLANE_TO_TRUE(real.plane) in plane_whitelist) @@ -1363,6 +1367,8 @@ GLOBAL_LIST_EMPTY(transformation_animation_objects) var/list/underlays_to_keep = list() for(var/mutable_appearance/special_underlay as anything in copy.underlays) + if(isnull(special_underlay)) + continue var/mutable_appearance/real = new() real.appearance = special_underlay if(PLANE_TO_TRUE(real.plane) in plane_whitelist)