summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hoffmann <jan@3e8.eu>2023-12-06 02:24:25 +0100
committerPaul Donald <newtwen@gmail.com>2023-12-06 02:27:32 +0100
commit9cd7b55210c767f858da0267807813e9ef19cd3a (patch)
tree5924a909cb2d42f9a6e29a6c4576fb3b38638699
parent89e438c967a1d5b160750f5c2aab1faae087fc5e (diff)
luci-app-vnstat2: fix configuration page when database is empty (#6746)
The output of the command "vnstat --dbiflist 1" is empty when there are no interfaces in the database. Add a check to avoid a "result.stdout is undefined" error in that case. Ref: https://forum.openwrt.org/t/error-in-luci-vnstat2-configuration-menu/179700 Fixes: 3ac4f567dfdf ("luci-app-vnstat2: use more efficient way to get database interfaces") Signed-off-by: Jan Hoffmann <jan@3e8.eu> (cherry picked from commit c0c37903f2276224c246c2a5ba0fb2732ba0e18a)
-rw-r--r--applications/luci-app-vnstat2/htdocs/luci-static/resources/view/vnstat2/config.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/applications/luci-app-vnstat2/htdocs/luci-static/resources/view/vnstat2/config.js b/applications/luci-app-vnstat2/htdocs/luci-static/resources/view/vnstat2/config.js
index 4d4bfd0dbe..dd5bf715e4 100644
--- a/applications/luci-app-vnstat2/htdocs/luci-static/resources/view/vnstat2/config.js
+++ b/applications/luci-app-vnstat2/htdocs/luci-static/resources/view/vnstat2/config.js
@@ -60,7 +60,7 @@ return view.extend({
o.load = function(section_id) {
return fs.exec('/usr/bin/vnstat', ['--dbiflist', '1']).then(L.bind(function(result) {
var databaseInterfaces = [];
- if (result.code == 0) {
+ if (result.code == 0 && result.stdout) {
databaseInterfaces = result.stdout.trim().split('\n');
}