From 8879c55bb39b31a03de5d798a436d73b30a011d6 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 28 Apr 2011 10:27:00 +0000 Subject: [PATCH] applications/luci-vnstat: fix crash if dbdir is defined but not existing yet --- applications/luci-vnstat/luasrc/model/cbi/vnstat.lua | 10 ++++++---- 1 file 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 -- 2.25.1