Software /
code /
prosody
Diff
util/xtemplate.lua @ 13499:1f93e4f78c53
util.xtemplate: Fix error on applying each() to zero stanzas
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 11 Jul 2024 15:04:29 +0200 |
parent | 13394:6debd8dd12ab |
child | 13501:05f028de4c45 |
line wrap: on
line diff
--- a/util/xtemplate.lua Sun Jul 07 18:40:25 2024 +0200 +++ b/util/xtemplate.lua Thu Jul 11 15:04:29 2024 +0200 @@ -39,7 +39,8 @@ 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 pre_blank .. post_blank end if not args then value, args = root, path; end local ns, name = s_match(args, "^(%b{})(.*)$"); if ns then