From 88aa7e1b05e4ba4bf96e5f177e86a1c5ef7d4e01 Mon Sep 17 00:00:00 2001 From: Mark Haslinghuis Date: Wed, 16 Dec 2020 18:10:37 +0100 Subject: [PATCH] Fix out of bound errors pid_tuning --- src/js/tabs/pid_tuning.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/js/tabs/pid_tuning.js b/src/js/tabs/pid_tuning.js index 77d9bf0a..e3a53436 100644 --- a/src/js/tabs/pid_tuning.js +++ b/src/js/tabs/pid_tuning.js @@ -1325,12 +1325,12 @@ TABS.pid_tuning.initialize = function (callback) { } // Add a name to each row of PIDs if empty - $('.pid_tuning tr').each(function(){ - for (let i = 0; i <= FC.PID_NAMES.length; i++) { - if ($(this).hasClass(FC.PID_NAMES[i])) { + $('.pid_tuning tr').each(function() { + for (const pidName of FC.PID_NAMES) { + if ($(this).hasClass(pidName)) { const firstColumn = $(this).find('td:first'); if (!firstColumn.text()) { - firstColumn.text(FC.PID_NAMES[i]); + firstColumn.text(pidName); } } } @@ -2412,8 +2412,8 @@ TABS.pid_tuning.updateRatesLabels = function() { ); } // then display them on the chart - for (let i = 0; i <= balloons.length; i++) { - balloons[i].balloon(); + for (const balloon of balloons) { + balloon.balloon(); } stickContext.restore();