# HG changeset patch
# User Matthew Wild <mwild1@gmail.com>
# Date 1479221896 0
# Node ID 12b78170b76cd7207fe263e245577c78889a529d
# Parent  c065ab67d8075ee9584a902115288a117d47af21
mod_firewall: INSPECT: Handle stanza:find() returning nil (i.e. path didn't match)

diff -r c065ab67d807 -r 12b78170b76c mod_firewall/conditions.lib.lua
--- a/mod_firewall/conditions.lib.lua	Tue Nov 15 14:57:40 2016 +0000
+++ b/mod_firewall/conditions.lib.lua	Tue Nov 15 14:58:16 2016 +0000
@@ -116,7 +116,7 @@
 			error("Stanza path does not return a string (append # for text content or @name for value of named attribute)", 0);
 		end
 		if is_pattern_match ~= "" then
-			return ("stanza:find(%q):match(%q)"):format(path:match("(.-)~=(.*)"));
+			return ("(stanza:find(%q) or ''):match(%q)"):format(path:match("(.-)~=(.*)"));
 		else
 			return ("stanza:find(%q) == %q"):format(path:match("(.-)=(.*)"));
 		end