From 33347deb9803dc8dfff68ab6c03737d7d82501cd Mon Sep 17 00:00:00 2001 From: KasparoVy Date: Thu, 14 Jul 2016 22:45:22 -0400 Subject: [PATCH] Fixes collar runtime by adding fexists checks. Collars still fully function (tested by wearing a Sec bombsuit as a Vox and as a Human, the correct collars rendered) and wearing a hardsuit as a Vulp (the situation provided in the bug report) didn't cause a runtime. --- code/modules/mob/living/carbon/human/update_icons.dm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index a9ff3a2c025..50270ed3f78 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -1269,13 +1269,17 @@ var/global/list/damage_icon_parts = list() if(wear_suit) if(wear_suit.icon_override) var/icon_path = "[wear_suit.icon_override]" - icon_path = "[copytext(icon_path, 1, findtext(icon_path, "/suit.dmi"))]/collar.dmi" //If this file doesn't exist, the end result is that COLLAR_LAYER will be unchanged (empty) so there won't be an issue. - var/icon/icon_file = new(icon_path) + icon_path = "[copytext(icon_path, 1, findtext(icon_path, "/suit.dmi"))]/collar.dmi" //If this file doesn't exist, the end result is that COLLAR_LAYER will be unchanged (empty). + var/icon/icon_file + if(fexists(icon_path)) //Just ensuring the nonexistance of a file with the above path won't cause a runtime. + icon_file = new(icon_path) standing = image("icon" = icon_file, "icon_state" = "[wear_suit.icon_state]") else if(wear_suit.sprite_sheets && wear_suit.sprite_sheets[species.name]) var/icon_path = "[wear_suit.sprite_sheets[species.name]]" - icon_path = "[copytext(icon_path, 1, findtext(icon_path, "/suit.dmi"))]/collar.dmi" //If this file doesn't exist, the end result is that COLLAR_LAYER will be unchanged (empty) so there won't be an issue. - var/icon/icon_file = new(icon_path) + icon_path = "[copytext(icon_path, 1, findtext(icon_path, "/suit.dmi"))]/collar.dmi" //If this file doesn't exist, the end result is that COLLAR_LAYER will be unchanged (empty). + var/icon/icon_file + if(fexists(icon_path)) //Just ensuring the nonexistance of a file with the above path won't cause a runtime. + icon_file = new(icon_path) standing = image("icon" = icon_file, "icon_state" = "[wear_suit.icon_state]") else if(wear_suit.icon_state in C.IconStates())