state: guard against null devstats in iface_add_counters

The devstats variable is populated via ubus call to udevstats dump,
which returns null when the udevstats service is unavailable. Add a
null check before indexing into devstats to prevent a runtime crash.

Signed-off-by: Lannar Dean <moracca@gmail.com>
This commit is contained in:
Lannar Dean
2026-01-18 01:46:04 -05:00
committed by John Crispin
parent d26c4b0a1e
commit e5a6295271

View File

@@ -574,7 +574,7 @@ if (!length(state.radios))
function iface_add_counters(iface, vlan, port) {
if (!devstats[port])
if (!devstats || !devstats[port])
return;
for (let k, vid in devstats[port]) {
if (vid.vid != vlan)