diff options
author | Kim Alvefur <zash@zash.se> | 2022-09-15 11:05:21 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2022-09-15 11:05:21 +0200 |
commit | f6727510da6c46942aab44bbb0ce692bebd566e9 (patch) | |
tree | 58a2f84740bfe3d0ae923292d4bc8dd6aba81895 /util/stanza.lua | |
parent | e38e915ef50ec62f1724ef55018b6b4120988a0d (diff) | |
download | prosody-f6727510da6c46942aab44bbb0ce692bebd566e9.tar.gz prosody-f6727510da6c46942aab44bbb0ce692bebd566e9.zip |
util.stanza: Return nil instead of nothing (fix test with luassert >=1.9)
Due to a change in luassert, a dependency luassert of the Busted test
framework, returning nothing is no longer treated as not falsy.
Diffstat (limited to 'util/stanza.lua')
-rw-r--r-- | util/stanza.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/util/stanza.lua b/util/stanza.lua index a38f80b3..29551918 100644 --- a/util/stanza.lua +++ b/util/stanza.lua @@ -164,6 +164,7 @@ function stanza_mt:get_child(name, xmlns) return child; end end + return nil; end function stanza_mt:get_child_text(name, xmlns) @@ -178,12 +179,14 @@ function stanza_mt:child_with_name(name) for _, child in ipairs(self.tags) do if child.name == name then return child; end end + return nil; end function stanza_mt:child_with_ns(ns) for _, child in ipairs(self.tags) do if child.attr.xmlns == ns then return child; end end + return nil; end function stanza_mt:get_child_with_attr(name, xmlns, attr_name, attr_value, normalize) @@ -192,6 +195,7 @@ function stanza_mt:get_child_with_attr(name, xmlns, attr_name, attr_value, norma return tag; end end + return nil; end function stanza_mt:children() @@ -350,6 +354,7 @@ function stanza_mt.get_text(t) if #t.tags == 0 then return t_concat(t); end + return nil; end function stanza_mt.get_error(stanza) |