From 3fda9ccd86424970a94f1149d6f0877a69967360 Mon Sep 17 00:00:00 2001 From: d00f Date: Fri, 14 Aug 2026 03:03:48 +0200 Subject: [PATCH] html: handle an empty MAC table reply and fix the entry cap l2.js reads the last index of a reply to know where the next page starts. With the firmware side of this branch an empty table answers [], and s[s.length-1] then throws on undefined. It used to answer commas with nothing between them and throw in JSON.parse instead, so this is the same case reaching a different line rather than a new one. An empty reply now renders what has been collected and starts the next pass from zero. The 4096 entry cap compared the array against the number instead of its length, so it never fired: an empty array and a 5000 element one both compare false. Comparing the length restores what the check was for. --- html/l2.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/html/l2.js b/html/l2.js index d3a058b..aa5742f 100644 --- a/html/l2.js +++ b/html/l2.js @@ -159,12 +159,17 @@ function getL2() { return e; }); l2Entries.push(...s); - if (l2Entries >= 4096) { + if (l2Entries.length >= 4096) { l2Entries = []; l2CurrentEntry = 0; clearInterval(l2GetInterval); return; } + if (!s.length) { + l2CurrentEntry = 0; + fillL2(l2Entries); + return; + } var w = 0; for (var i = l2Entries.length-1; i > 0; i--) { if (l2Entries[0].idx == l2Entries[i].idx) {