# HG changeset patch # User Matthew Wild # Date 1365253382 -3600 # Node ID a88f33fe697026b249dffb8dd92ee222eba2e83c # Parent a65df6e97d94bc43806aa37bbab3fb144cbd8cca mod_firewall: Don't add empty conditions check when no conditions are listed in a rule diff -r a65df6e97d94 -r a88f33fe6970 mod_firewall/mod_firewall.lua --- a/mod_firewall/mod_firewall.lua Sat Apr 06 14:02:38 2013 +0100 +++ b/mod_firewall/mod_firewall.lua Sat Apr 06 14:03:02 2013 +0100 @@ -256,9 +256,12 @@ for _, dep in ipairs(rule.deps) do include_dep(dep, code); end - local rule_code = "if ("..table.concat(rule.conditions, ") and (")..") then\n\t" - ..table.concat(rule.actions, "\n\t") - .."\n end\n"; + local rule_code = table.concat(rule.actions, "\n\t"); + if #rule.conditions > 0 then + rule_code = "if ("..table.concat(rule.conditions, ") and (")..") then\n\t" + ..rule_code + .."\n end\n"; + end table.insert(code, rule_code); end