Fixes runtime when clicking an empty coat hanger with empty hand. (#22577)

* prevents runtime if the hanger is clicked when its empty

* changes recommended on code chat

* Update code/game/objects/structures/coathanger.dm

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>

---------

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
This commit is contained in:
meow20
2023-09-30 14:38:14 +02:00
committed by GitHub
parent 1e15d92667
commit f3a5ef74ca
+4 -2
View File
@@ -6,8 +6,10 @@
var/obj/item/clothing/suit/coat
var/list/allowed = list(/obj/item/clothing/suit/storage/labcoat, /obj/item/clothing/suit/storage/det_suit)
/obj/structure/coatrack/attack_hand(mob/user as mob)
user.visible_message("[user] takes [coat] off \the [src].", "You take [coat] off the \the [src]")
/obj/structure/coatrack/attack_hand(mob/user)
if(isnull(coat))
return
user.visible_message("[user] takes [coat] off [src].", "You take [coat] off [src]")
if(!user.put_in_active_hand(coat))
coat.forceMove(get_turf(user))
coat = null