From f86e4737dbd9a1958ce80964b1c13dbe1a1efe97 Mon Sep 17 00:00:00 2001 From: Zonespace <41448081+Zonespace27@users.noreply.github.com> Date: Tue, 28 Nov 2023 15:32:26 -0800 Subject: [PATCH] Fix nullspaced closet runtime (#4964) # About the pull request ![image](https://github.com/cmss13-devs/cmss13/assets/41448081/a87707be-a80e-4e72-b6ea-d98d4172de79) --- code/game/objects/structures/crates_lockers/closets.dm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index d6148b23b7f0..2efd8e4e81e9 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -158,10 +158,15 @@ /obj/structure/closet/proc/take_damage(damage) + if(health <= 0) + return + health = max(health - damage, 0) if(health <= 0) - for(var/atom/movable/A as anything in src) - A.forceMove(src.loc) + for(var/atom/movable/movable as anything in src) + if(!loc) + break + movable.forceMove(loc) playsound(loc, 'sound/effects/meteorimpact.ogg', 25, 1) qdel(src)