From a19acf17b38c0c3c21df434bcbadc2545203ed59 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Mon, 29 Mar 2021 21:04:47 +0200 Subject: [PATCH] Fix when total <0 --- luci-app-mptcp/luasrc/controller/mptcp.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/luci-app-mptcp/luasrc/controller/mptcp.lua b/luci-app-mptcp/luasrc/controller/mptcp.lua index 53ead344f..249179514 100644 --- a/luci-app-mptcp/luasrc/controller/mptcp.lua +++ b/luci-app-mptcp/luasrc/controller/mptcp.lua @@ -74,7 +74,6 @@ function multipath_bandwidth() multipath = "off" end if multipath == "on" or multipath == "master" or multipath == "backup" or multipath == "handover" then - local bwc = luci.sys.exec("luci-bwc -i %q 2>/dev/null" % dev) or "" 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]', '') .. "]" @@ -121,13 +120,13 @@ function multipath_bandwidth() res[key][i][j]= tonumber(res[key][i][j]) res["total"][i][j]= tonumber(res["total"][i][j]) if j ==1 then - if res[key][i][j] ~= nil then + if res[key][i][j] ~= nil and res[key][i][j] > 0 then res["total"][i][j] = res[key][i][j] else res["total"][i][j] = 0 end else - if res[key][i][j] ~= nil then + if res[key][i][j] ~= nil and res[key][i][j] > 0 then res["total"][i][j] = res["total"][i][j] + res[key][i][j] end end