From 75eee04972ad51f48e517f2c2b065343eb42ef13 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Mon, 20 May 2024 16:10:15 +1200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20Return=200=20for=20bad=20index?= =?UTF-8?q?=20in=20Temperature::getHeaterPower=20(#27037)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/module/temperature.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 95d2da38f1..16b43f62f0 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -1303,8 +1303,10 @@ int16_t Temperature::getHeaterPower(const heater_id_t heater_id) { #if HAS_COOLER case H_COOLER: return temp_cooler.soft_pwm_amount; #endif - default: - return TERN0(HAS_HOTEND, temp_hotend[heater_id].soft_pwm_amount); + #if HAS_HOTEND + case 0 ... HOTENDS - 1: return temp_hotend[heater_id].soft_pwm_amount; + #endif + default: return 0; } }