From 59b6267a0154ad0057d32883b9645e8f045d5186 Mon Sep 17 00:00:00 2001 From: Drathek <76988376+Drulikar@users.noreply.github.com> Date: Sun, 4 Feb 2024 14:26:58 -0800 Subject: [PATCH] Add null conditional operators to helmet code (#5660) # About the pull request So I am not able to reproduce the runtime spam errors reported in #5656 prompting #5655 but I have added null conditional operators where it is complaining. # Explain why it's good for the game Less runtimes? Fixes #5656 # Testing Photographs and Procedure Untested other than confirming it still seems fine? Please let me know if you know how to reproduce it. # Changelog :cl: Drathek fix: Added more null testing to helmet visors. /:cl: --- code/modules/clothing/head/helmet.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index e8643e14a144..b5775652d8f6 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -677,7 +677,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( if(length(total_visors) > iterator) var/obj/item/device/helmet_visor/next_visor = total_visors[iterator + 1] - if(!isnull(GLOB.huds[next_visor.hud_type].hudusers[user])) + if(!isnull(GLOB.huds[next_visor.hud_type]?.hudusers[user])) iterator++ skipped_hud = TRUE continue @@ -694,7 +694,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( for(var/obj/item/device/helmet_visor/new_visor in total_visors) - if(!isnull(GLOB.huds[new_visor.hud_type].hudusers[user])) + if(!isnull(GLOB.huds[new_visor.hud_type]?.hudusers[user])) continue active_visor = new_visor