diff options
author | Matthew Wild <mwild1@gmail.com> | 2018-03-21 22:04:20 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2018-03-21 22:04:20 +0000 |
commit | 9306e1a074ac5480754da10722919f147af7d65f (patch) | |
tree | b1d4d8f36ea491c794e1ac093b5fd56a6c034abf /util/stanza.lua | |
parent | d0d92da7faf7992e6a696201baeb3554080d3468 (diff) | |
download | prosody-9306e1a074ac5480754da10722919f147af7d65f.tar.gz prosody-9306e1a074ac5480754da10722919f147af7d65f.zip |
util.stanza: Allow :text(nil) and :text("") as harmless nops
Diffstat (limited to 'util/stanza.lua')
-rw-r--r-- | util/stanza.lua | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/util/stanza.lua b/util/stanza.lua index d16fc947..4a0a9ce8 100644 --- a/util/stanza.lua +++ b/util/stanza.lua @@ -111,9 +111,11 @@ function stanza_mt:tag(name, attr, namespaces) 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 |