mod_cache_c2s_caps: Use the correct argument, and check for origin’s nil-ness
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Wed, 06 Mar 2019 01:30:54 +0100
changeset 3479 820c891a54cc
parent 3478 c3b886331de7
child 3480 4ce945490a24
mod_cache_c2s_caps: Use the correct argument, and check for origin’s nil-ness
mod_cache_c2s_caps/mod_cache_c2s_caps.lua
--- 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)