From c2aa82798010d35ee033edaa322eb8e0bfadfcf4 Mon Sep 17 00:00:00 2001 From: fujr Date: Thu, 12 Dec 2024 23:29:17 +0800 Subject: [PATCH] luci: fix error when modem_name or modem_base info is emtpy --- luci/luci-app-qmodem/luasrc/controller/qmodem.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/luci/luci-app-qmodem/luasrc/controller/qmodem.lua b/luci/luci-app-qmodem/luasrc/controller/qmodem.lua index 7f8fe73..26e0ccf 100644 --- a/luci/luci-app-qmodem/luasrc/controller/qmodem.lua +++ b/luci/luci-app-qmodem/luasrc/controller/qmodem.lua @@ -108,7 +108,7 @@ function getOverviews() local logs={} uci:foreach("qmodem", "modem-device", function (modem_device) section_name = modem_device[".name"] - modem_name = modem_device["name"] + modem_name = modem_device["name"] or luci.i18n.translate("Unknown") alias = modem_device["alias"] modem_state = modem_device["state"] if modem_state == "disabled" then @@ -117,7 +117,7 @@ function getOverviews() --模组信息部分 cmd = modem_ctrl.."base_info "..section_name result = shell(cmd) - json_result = json.parse(result) + json_result = json.parse(result) or "{}" modem_info = json_result["modem_info"] tmp_info = {} if alias then