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
|
end
|
||||||
|
|
||||||
function forwarding.src_zone(self)
|
function forwarding.src_zone(self)
|
||||||
return zone(self:src())
|
local z = zone(self:src())
|
||||||
|
return z.sid and z
|
||||||
end
|
end
|
||||||
|
|
||||||
function forwarding.dest_zone(self)
|
function forwarding.dest_zone(self)
|
||||||
return zone(self:dest())
|
local z = zone(self:dest())
|
||||||
|
return z.sid and z
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -43,11 +43,12 @@
|
||||||
 ⇒ 
|
 ⇒ 
|
||||||
<% for _, fwd in ipairs(zone:get_forwardings_by("src")) do
|
<% for _, fwd in ipairs(zone:get_forwardings_by("src")) do
|
||||||
fz = fwd:dest_zone()
|
fz = fwd:dest_zone()
|
||||||
|
if fz then
|
||||||
empty = false %>
|
empty = false %>
|
||||||
<label class="zonebadge" style="background-color:<%=fz:get_color()%>">
|
<label class="zonebadge" style="background-color:<%=fz:get_color()%>">
|
||||||
<strong><%=fz:name()%></strong>
|
<strong><%=fz:name()%></strong>
|
||||||
</label> 
|
</label> 
|
||||||
<% end %>
|
<% end end %>
|
||||||
<% if empty then %>
|
<% if empty then %>
|
||||||
<label class="zonebadge zonebadge-empty">
|
<label class="zonebadge zonebadge-empty">
|
||||||
<strong><%=zone:forward():upper()%></strong>
|
<strong><%=zone:forward():upper()%></strong>
|
||||||
|
|
Loading…
Reference in a new issue