Skip to content

Commit 676a064

Browse files
ellenspthinkyhead
authored andcommitted
🩹 Return 0 for bad index in Temperature::getHeaterPower (MarlinFirmware#27037)
Co-authored-by: Scott Lahteine <[email protected]>
1 parent bf9b0a0 commit 676a064

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Marlin/src/module/temperature.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,8 +1303,10 @@ int16_t Temperature::getHeaterPower(const heater_id_t heater_id) {
13031303
#if HAS_COOLER
13041304
case H_COOLER: return temp_cooler.soft_pwm_amount;
13051305
#endif
1306-
default:
1307-
return TERN0(HAS_HOTEND, temp_hotend[heater_id].soft_pwm_amount);
1306+
#if HAS_HOTEND
1307+
case 0 ... HOTENDS - 1: return temp_hotend[heater_id].soft_pwm_amount;
1308+
#endif
1309+
default: return 0;
13081310
}
13091311
}
13101312

0 commit comments

Comments
 (0)