changeset 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 9a3dfe0bf9fd
children 44c2d36c40a4
files mod_rest/mod_rest.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
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);