luci-mod-status: gracefully handle missing port stats
authorJo-Philipp Wich <jo@mein.io>
Sat, 29 Jul 2023 20:03:31 +0000 (22:03 +0200)
committerJo-Philipp Wich <jo@mein.io>
Sat, 29 Jul 2023 20:05:23 +0000 (22:05 +0200)
Ref: https://github.com/openwrt/luci/commit/cba58fcafbe3a3f4f599354f7c123b546e045887#commitcomment-123043170
Fixes: 4e46624817 ("luci-mod-status: introduce ethernet port status view")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 00a941e618ecfb80dcccc5fd8e7d5d3eecb674b5)

modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/29_ports.js

index 31af6f460c0315955d33c6477c8ba0968ebb146e..b226e4f3c60cef8ba4e1d0ff2d7bef515aaf8310 100644 (file)
@@ -217,7 +217,7 @@ function formatSpeed(speed, duplex) {
 }
 
 function formatStats(portdev) {
-       var stats = portdev._devstate('stats');
+       var stats = portdev._devstate('stats') || {};
 
        return ui.itemlist(E('span'), [
                _('Received bytes'), '%1024mB'.format(stats.rx_bytes),