From bc5bab7bc195b1721ae1f6cb6b6177aec8ba7493 Mon Sep 17 00:00:00 2001 From: mochi Date: Wed, 24 Jun 2020 11:22:35 +0200 Subject: [PATCH] Add type checks in case of Initialize() weirdness --- code/modules/clothing/under/accessories/accessory.dm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/code/modules/clothing/under/accessories/accessory.dm b/code/modules/clothing/under/accessories/accessory.dm index 95a6b289d23..673b6a14b9a 100644 --- a/code/modules/clothing/under/accessories/accessory.dm +++ b/code/modules/clothing/under/accessories/accessory.dm @@ -37,6 +37,12 @@ var/mob/M = has_suit.loc A.Grant(M) + if (islist(has_suit.armor) || isnull(has_suit.armor)) // This proc can run before /obj/Initialize has run for U and src, + has_suit.armor = getArmor(arglist(has_suit.armor)) // we have to check that the armor list has been transformed into a datum before we try to call a proc on it + // This is safe to do as /obj/Initialize only handles setting up the datum if actually needed. + if (islist(armor) || isnull(armor)) + armor = getArmor(arglist(armor)) + has_suit.armor = has_suit.armor.attachArmor(armor) if(user)