🩹 Return 0 for bad index in Temperature::getHeaterPower (#27037)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
ellensp
2024-05-20 16:10:15 +12:00
committed by GitHub
parent ee1d1faa52
commit 75eee04972

View File

@@ -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;
}
}