luci-base: gracefully handle broken firewall forwarding sections
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
462779c384
commit
98aacba3ac
2 changed files with 7 additions and 4 deletions
|
@ -498,11 +498,13 @@ function forwarding.dest(self)
|
|||
end
|
||||
|
||||
function forwarding.src_zone(self)
|
||||
return zone(self:src())
|
||||
local z = zone(self:src())
|
||||
return z.sid and z
|
||||
end
|
||||
|
||||
function forwarding.dest_zone(self)
|
||||
return zone(self:dest())
|
||||
local z = zone(self:dest())
|
||||
return z.sid and z
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -43,11 +43,12 @@
|
|||
 ⇒ 
|
||||
<% for _, fwd in ipairs(zone:get_forwardings_by("src")) do
|
||||
fz = fwd:dest_zone()
|
||||
empty = false %>
|
||||
if fz then
|
||||
empty = false %>
|
||||
<label class="zonebadge" style="background-color:<%=fz:get_color()%>">
|
||||
<strong><%=fz:name()%></strong>
|
||||
</label> 
|
||||
<% end %>
|
||||
<% end end %>
|
||||
<% if empty then %>
|
||||
<label class="zonebadge zonebadge-empty">
|
||||
<strong><%=zone:forward():upper()%></strong>
|
||||
|
|
Loading…
Reference in a new issue