From f65b711376d28fda6c508f79ff8e943d5cda6961 Mon Sep 17 00:00:00 2001 From: Adam Bird Date: Sat, 16 Dec 2023 20:52:07 -0500 Subject: [PATCH] fix led crash when set to health (#3507) --- soh/soh/OTRGlobals.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 3e1c8bba2..872cf5130 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -2100,10 +2100,10 @@ Color_RGB8 GetColorForControllerLED() { if (source == LED_SOURCE_CUSTOM) { color = CVarGetColor24("gLedPort1Color", { 255, 255, 255 }); } - if (criticalOverride || source == LED_SOURCE_HEALTH) { + if (gPlayState && (criticalOverride || source == LED_SOURCE_HEALTH)) { if (HealthMeter_IsCritical()) { color = { 0xFF, 0, 0 }; - } else if (source == LED_SOURCE_HEALTH) { + } else if (gSaveContext.healthCapacity != 0 && source == LED_SOURCE_HEALTH) { if (gSaveContext.health / gSaveContext.healthCapacity <= 0.4f) { color = { 0xFF, 0xFF, 0 }; } else {