diff mod_rest/mod_rest.lua @ 3879:3b31ff7b4c7c

mod_rest: Fix traceback Might have been caused by receiving a stanza here. Otherwise how could there be an util.error object without .context ?
author Kim Alvefur <zash@zash.se>
date Tue, 04 Feb 2020 22:22:47 +0100
parents 75b330d4fa6f
children 3d0e8e32453c
line wrap: on
line diff
--- a/mod_rest/mod_rest.lua	Tue Feb 04 22:06:19 2020 +0100
+++ b/mod_rest/mod_rest.lua	Tue Feb 04 22:22:47 2020 +0100
@@ -143,7 +143,7 @@
 				return encode(send_type, result.stanza);
 			end,
 			function (error)
-				if error.context.stanza then
+				if error.context and error.context.stanza then
 					response.headers.content_type = send_type;
 					module:log("debug", "Sending[rest]: %s", error.context.stanza:top_tag());
 					return encode(send_type, error.context.stanza);