From 1061d8f263f5269d422479e8f6ae718188e938d7 Mon Sep 17 00:00:00 2001 From: Ycarus Date: Wed, 19 Sep 2018 09:19:12 +0200 Subject: [PATCH] Fix https://github.com/Ysurac/openmptcprouter/issues/174 (at least fix the error in log) --- luci-app-mptcp/luasrc/controller/mptcp.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/luci-app-mptcp/luasrc/controller/mptcp.lua b/luci-app-mptcp/luasrc/controller/mptcp.lua index f4a9002d4..69ea37d7a 100644 --- a/luci-app-mptcp/luasrc/controller/mptcp.lua +++ b/luci-app-mptcp/luasrc/controller/mptcp.lua @@ -37,7 +37,12 @@ function multipath_bandwidth() if dev ~= "lo" and dev ~= "" then local multipath = s["multipath"] or "off" if multipath == "on" or multipath == "master" or multipath == "backup" or multipath == "handover" then - result[dev] = "[" .. string.gsub((luci.sys.exec("luci-bwc -i %q 2>/dev/null" % dev)), '[\r\n]', '') .. "]" + local bwc = luci.sys.exec("luci-bwc -i %q 2>/dev/null" % dev) or "" + if bwc ~= nil then + result[dev] = "[" .. string.gsub(bwc, '[\r\n]', '') .. "]" + else + result[dev] = "[]" + end end end end)