changeset 3475:820c891a54cc

mod_cache_c2s_caps: Use the correct argument, and check for origin’s nil-ness
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 06 Mar 2019 01:30:54 +0100
parents c3b886331de7
children 4ce945490a24
files mod_cache_c2s_caps/mod_cache_c2s_caps.lua
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mod_cache_c2s_caps/mod_cache_c2s_caps.lua	Wed Mar 06 00:59:48 2019 +0100
+++ b/mod_cache_c2s_caps/mod_cache_c2s_caps.lua	Wed Mar 06 01:30:54 2019 +0100
@@ -50,10 +50,12 @@
 	return true;
 end
 
-local function iq_error_handler(event)
-	local origin = event.origin;
-	origin.caps_cache = nil;
-	module:fire_event("c2s-capabilities-changed", { origin = origin });
+local function iq_error_handler(err)
+	local origin = err.context.origin;
+	if origin ~= nil then
+		origin.caps_cache = nil;
+		module:fire_event("c2s-capabilities-changed", { origin = origin });
+	end
 end
 
 local function presence_stanza_handler(event)