Changeset

3111:7a3ac037e57f

mod_cache_c2s_caps: Fix traceback on invalid payload in disco#info result.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 08 Jun 2018 21:59:42 +0200
parents 3110:06e07b483805
children 3112:ed948c75e53e
files mod_cache_c2s_caps/mod_cache_c2s_caps.lua
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_cache_c2s_caps/mod_cache_c2s_caps.lua	Fri Jun 08 17:56:54 2018 +0200
+++ b/mod_cache_c2s_caps/mod_cache_c2s_caps.lua	Fri Jun 08 21:59:42 2018 +0200
@@ -10,11 +10,15 @@
 
 local function iq_result_handler(event)
 	local origin, stanza = event.origin, event.stanza;
+
+	local query = stanza:get_child("query", "http://jabber.org/protocol/disco#info");
+	if not query then
+		origin.log("debug", "Wrong iq payload in disco#info result: %s", stanza);
+		return;
+	end
+
 	local from = stanza.attr.from;
 	local id = stanza.attr.id;
-
-	local query = stanza:get_child("query", "http://jabber.org/protocol/disco#info");
-
 	local node_string = query.attr.node;
 	local node_query = iq_node_map[from..id];
 	if node_string == nil then