Diff

mod_cache_c2s_caps/mod_cache_c2s_caps.lua @ 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
parent 3464:13b394b0db82
child 4018:f27becd421bd
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)