projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c499b83
)
applications/luci-vnstat: fix crash if database dir does not exist
author
Jo-Philipp Wich
<jow@openwrt.org>
Fri, 14 Jan 2011 15:33:16 +0000
(15:33 +0000)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Fri, 14 Jan 2011 15:33:16 +0000
(15:33 +0000)
applications/luci-vnstat/luasrc/view/vnstat.htm
patch
|
blob
|
history
diff --git
a/applications/luci-vnstat/luasrc/view/vnstat.htm
b/applications/luci-vnstat/luasrc/view/vnstat.htm
index
91fd332
..
d67f9b3
100644
(file)
--- a/
applications/luci-vnstat/luasrc/view/vnstat.htm
+++ b/
applications/luci-vnstat/luasrc/view/vnstat.htm
@@
-82,13
+82,22
@@
dbdir = dbdir or "/var/lib/vnstat"
<br /><hr /><br />
<div style="text-align:center">
<br /><hr /><br />
<div style="text-align:center">
-<% empty = true
- for iface in fs.dir(dbdir) do if iface:sub(1,1) ~= "." then
- empty = false
+<%
+ empty = true
+ 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="" />
<br /><br />
%>
<img src="<%=REQUEST_URI%>?iface=<%=iface%>&style=<%=param('style')%>" alt="" />
<br /><br />
-<% end end %>
+<%
+ end
+ end
+ end
+%>
<% 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>
<% 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>