Diff

util/stanza.lua @ 10442:22db763c510c

util.stanza: Check that argument to reply is a stanza
author Kim Alvefur <zash@zash.se>
date Mon, 25 Nov 2019 20:44:05 +0100
parent 10116:4807535b8673
child 10443:f28718f46196
line wrap: on
line diff
--- a/util/stanza.lua	Sun Nov 24 04:46:36 2019 +0100
+++ b/util/stanza.lua	Mon Nov 25 20:44:05 2019 +0100
@@ -434,6 +434,9 @@
 end
 
 local function reply(orig)
+	if not is_stanza(orig) then
+		error("bad argument to reply: expected stanza, got "..type(orig));
+	end
 	return new_stanza(orig.name,
 		orig.attr and {
 			to = orig.attr.from,