# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1580851367 -3600
# Node ID 3b31ff7b4c7c06824cd4897fd7900a2f2654abd7
# Parent  9a3dfe0bf9fd73da852a10a4f49848c6740b23bb
mod_rest: Fix traceback

Might have been caused by receiving a stanza here. Otherwise how could
there be an util.error object without .context ?

diff -r 9a3dfe0bf9fd -r 3b31ff7b4c7c mod_rest/mod_rest.lua
--- 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);