Software /
code /
prosody
Changeset
8640:8f13ec2ceb06
util.stanza: Allow :text(nil) and :text("") as harmless nops
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 21 Mar 2018 22:04:20 +0000 |
parents | 8639:070a77c15f63 |
children | 8641:c7734b59506f |
files | util/stanza.lua |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/util/stanza.lua Wed Mar 21 16:31:48 2018 +0100 +++ b/util/stanza.lua Wed Mar 21 22:04:20 2018 +0000 @@ -111,9 +111,11 @@ end function stanza_mt:text(text) - check_text(text, "text"); - local last_add = self.last_add; - (last_add and last_add[#last_add] or self):add_direct_child(text); + if text ~= nil and text ~= "" then + check_text(text, "text"); + local last_add = self.last_add; + (last_add and last_add[#last_add] or self):add_direct_child(text); + end return self; end