From ecd490ed49e2d6d5e1754fda4cccf7f19cda8e70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Br=C3=A1zio?= Date: Sun, 15 May 2016 22:45:08 +0100 Subject: [PATCH] Bugfix: iteration invokes undefined behavior --- Marlin/temperature.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 76bab525f..63db7e9ea 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -342,7 +342,7 @@ int Temperature::getHeaterPower(int heater) { EXTRUDER_3_AUTO_FAN_PIN == EXTRUDER_2_AUTO_FAN_PIN ? 2 : 3 }; uint8_t fanState = 0; - for (int f = 0; f <= 3; f++) { + for (int f = 0; f <= EXTRUDERS; f++) { if (current_temperature[f] > EXTRUDER_AUTO_FAN_TEMPERATURE) SBI(fanState, fanBit[f]); }