Changeset

12724:5b5b428d67e2 0.12

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.
author Kim Alvefur <zash@zash.se>
date Thu, 15 Sep 2022 11:05:21 +0200
parents 12679:7d4a95ba9b6c
children 12725:12ced5db29b2 12756:cd7da871ce10
files util/stanza.lua
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/util/stanza.lua	Fri Aug 26 18:53:00 2022 +0200
+++ b/util/stanza.lua	Thu Sep 15 11:05:21 2022 +0200
@@ -164,6 +164,7 @@
 			return child;
 		end
 	end
+	return nil;
 end
 
 function stanza_mt:get_child_text(name, xmlns)
@@ -178,12 +179,14 @@
 	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 @@
 			return tag;
 		end
 	end
+	return nil;
 end
 
 function stanza_mt:children()
@@ -350,6 +354,7 @@
 	if #t.tags == 0 then
 		return t_concat(t);
 	end
+	return nil;
 end
 
 function stanza_mt.get_error(stanza)