Skip to content

Commit

Permalink
luci-app-vnstat2: fix configuration page when database is empty (#6746)
Browse files Browse the repository at this point in the history
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: 3ac4f56 ("luci-app-vnstat2: use more efficient way to get database interfaces")

Signed-off-by: Jan Hoffmann <jan@3e8.eu>
  • Loading branch information
janh authored Dec 6, 2023
1 parent b3d1d05 commit c0c3790
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down

0 comments on commit c0c3790

Please sign in to comment.