# HG changeset patch # User Matthew Wild # Date 1521669860 0 # Node ID 8f13ec2ceb06c0bd2a192c63be5e8a35603de14e # Parent 070a77c15f631a6fe03216127d6b2821e779c64d util.stanza: Allow :text(nil) and :text("") as harmless nops diff -r 070a77c15f63 -r 8f13ec2ceb06 util/stanza.lua --- 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