fix led crash when set to health (#3507)

This commit is contained in:
Adam Bird 2023-12-16 20:52:07 -05:00 committed by GitHub
parent 269e9faa46
commit f65b711376
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2100,10 +2100,10 @@ Color_RGB8 GetColorForControllerLED() {
if (source == LED_SOURCE_CUSTOM) { if (source == LED_SOURCE_CUSTOM) {
color = CVarGetColor24("gLedPort1Color", { 255, 255, 255 }); color = CVarGetColor24("gLedPort1Color", { 255, 255, 255 });
} }
if (criticalOverride || source == LED_SOURCE_HEALTH) { if (gPlayState && (criticalOverride || source == LED_SOURCE_HEALTH)) {
if (HealthMeter_IsCritical()) { if (HealthMeter_IsCritical()) {
color = { 0xFF, 0, 0 }; 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) { if (gSaveContext.health / gSaveContext.healthCapacity <= 0.4f) {
color = { 0xFF, 0xFF, 0 }; color = { 0xFF, 0xFF, 0 };
} else { } else {