ui: guard meta count against null tunnels list
CI / validate (push) Successful in 7s
CI / docker (push) Failing after 5s

/api/tunnels returns {"tunnels": null} when no bridges are active.
The previous code path short-circuited the empty render but still
dereferenced j.tunnels.length on the line that updates the header
meta — TypeError, then the "— connecting…" placeholder stuck around
forever. Coalesce to [] before .length.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 00:08:17 +02:00
parent 41a7e39754
commit 3e3f2333e4
+1 -1
View File
@@ -118,7 +118,7 @@ async function refreshConnections() {
rows.appendChild(tr); rows.appendChild(tr);
} }
} }
document.getElementById('meta').textContent = '— ' + j.tunnels.length + ' tunnels'; document.getElementById('meta').textContent = '— ' + ((j.tunnels || []).length) + ' tunnels';
} catch (e) { } catch (e) {
document.getElementById('meta').textContent = '— api error'; document.getElementById('meta').textContent = '— api error';
} }