From bb278430cf13e3fbbdf0d36a5884c74a067e4a86 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 11 Jul 2024 15:24:19 +0200 Subject: util.xtemplate: Fix error on applying each() to zero stanzas Backport of 1f93e4f78c53 --- util/xtemplate.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'util/xtemplate.lua') diff --git a/util/xtemplate.lua b/util/xtemplate.lua index 254c8af0..88baf1f7 100644 --- a/util/xtemplate.lua +++ b/util/xtemplate.lua @@ -31,7 +31,8 @@ local function render(template, root, escape, filters) if tmpl then tmpl = s_sub(tmpl, 2, -2); end if args then args = s_sub(args, 2, -2); end - if func == "each" and tmpl and st.is_stanza(value) then + if func == "each" and tmpl then + if not st.is_stanza(value) then return "" end if not args then value, args = root, path; end local ns, name = s_match(args, "^(%b{})(.*)$"); if ns then -- cgit v1.2.3