applications/luci-vnstat: fix crash if database dir does not exist
This commit is contained in:
parent
c499b83756
commit
180dbe580b
1 changed files with 13 additions and 4 deletions
|
@ -82,13 +82,22 @@ dbdir = dbdir or "/var/lib/vnstat"
|
||||||
<br /><hr /><br />
|
<br /><hr /><br />
|
||||||
|
|
||||||
<div style="text-align:center">
|
<div style="text-align:center">
|
||||||
<% empty = true
|
<%
|
||||||
for iface in fs.dir(dbdir) do if iface:sub(1,1) ~= "." then
|
empty = true
|
||||||
empty = false
|
ifdir = fs.dir(dbdir)
|
||||||
|
|
||||||
|
if ifdir then
|
||||||
|
for iface in ifdir do
|
||||||
|
if iface:sub(1,1) ~= "." then
|
||||||
|
empty = false
|
||||||
%>
|
%>
|
||||||
<img src="<%=REQUEST_URI%>?iface=<%=iface%>&style=<%=param('style')%>" alt="" />
|
<img src="<%=REQUEST_URI%>?iface=<%=iface%>&style=<%=param('style')%>" alt="" />
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<% end end %>
|
<%
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
|
||||||
<% if empty then %>
|
<% if empty then %>
|
||||||
<p><em><%:No database has been set up yet. Go to the VnStat configuration and enable monitoring for one or more interfaces.%></em></p>
|
<p><em><%:No database has been set up yet. Go to the VnStat configuration and enable monitoring for one or more interfaces.%></em></p>
|
||||||
|
|
Loading…
Reference in a new issue