From 450cdb61201409fee2e4375511955810d6616234 Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.comā©> Date: Sat, 9 Mar 2024 03:25:27 +0100 Subject: [PATCH] android:actTrk: fix find index and return list --- apps/android/boot.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/android/boot.js b/apps/android/boot.js index 6b7d81b72c7..666cac6d370 100644 --- a/apps/android/boot.js +++ b/apps/android/boot.js @@ -236,8 +236,12 @@ "listRecs": function() { let recs = require("Storage").list(/^recorder\.log.*\.csv$/,{sf:true}).map(s => s.slice(12, 21)); if (event.id.length > 2) { // Handle if there was no id supplied. Then we send a list all available recorder logs back. - let isFirstNonsyncedIdx = recs.findIndex((logId) => logId > event.id); - recs = recs.slice(isFirstNonsyncedIdx+1); + let firstNonsyncedIdx = recs.findIndex((logId) => logId > event.id); + if (-1 == firstNonsyncedIdx) { + recs = [] + } else { + recs = recs.slice(firstNonsyncedIdx); + } } gbSend({t:"actTrksList", list: recs}); // TODO: split up in multiple transmissions? },