From ca6e86a697a7dc3d6f4a082c8c9d2908820bb4f3 Mon Sep 17 00:00:00 2001 From: Mattk70 Date: Fri, 8 Mar 2024 08:17:40 +0000 Subject: [PATCH] fixed setting activeRow when "start civil twilight" in table --- js/ui.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/ui.js b/js/ui.js index deabfec7..ef52cd64 100644 --- a/js/ui.js +++ b/js/ui.js @@ -2893,12 +2893,14 @@ function onChartData(args) { for (var i = 0; i < table.rows.length; i++) { const row = table.rows[i]; // Get the value of the name attribute and split it on '|' - // State time is the second value in the name string - const startTime = row.getAttribute('name').split('|')[1]; + // Start time is the second value in the name string + const nameAttr = row.getAttribute('name') + // no nameAttr for start civil twilight row + const startTime = nameAttr ? nameAttr.split('|')[1] : 0; // Check if the second value matches the 'select' variable if (parseFloat(startTime) === start) { - return i; + return i; } } }