ui: guard meta count against null tunnels list
/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:
@@ -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';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user