summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-vnstat
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2011-04-28 10:27:00 +0000
committerJo-Philipp Wich <jow@openwrt.org>2011-04-28 10:27:00 +0000
commit8879c55bb39b31a03de5d798a436d73b30a011d6 (patch)
tree14b7aeb7d1d3cb13c2d51fde123d1af1bfa7c9a0 /applications/luci-vnstat
parent254c8d368ec37d76fe73f540be7af119b00acb1a (diff)
applications/luci-vnstat: fix crash if dbdir is defined but not existing yet
Diffstat (limited to 'applications/luci-vnstat')
-rw-r--r--applications/luci-vnstat/luasrc/model/cbi/vnstat.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/applications/luci-vnstat/luasrc/model/cbi/vnstat.lua b/applications/luci-vnstat/luasrc/model/cbi/vnstat.lua
index 9161ec6a6..5c5e8f7aa 100644
--- a/applications/luci-vnstat/luasrc/model/cbi/vnstat.lua
+++ b/applications/luci-vnstat/luasrc/model/cbi/vnstat.lua
@@ -37,10 +37,12 @@ local ifaces = { }
local enabled = { }
local iface
-for iface in fs.dir(dbdir) do
- if iface:sub(1,1) ~= '.' then
- ifaces[iface] = iface
- enabled[iface] = iface
+if fs.access(dbdir) then
+ for iface in fs.dir(dbdir) do
+ if iface:sub(1,1) ~= '.' then
+ ifaces[iface] = iface
+ enabled[iface] = iface
+ end
end
end