Changeset

146:2678048e93e6

plugins.disco: Fix traceback when disco#info isn't returned for a service in disco#items
author Matthew Wild <mwild1@gmail.com>
date Mon, 11 Oct 2010 02:01:07 +0100
parents 144:46e933d81024
children 147:c95b84ed366b
files plugins/disco.lua
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/disco.lua	Fri Sep 17 16:42:50 2010 +0100
+++ b/plugins/disco.lua	Mon Oct 11 02:01:07 2010 +0100
@@ -356,11 +356,14 @@
 		initial_disco_started = true;
 		stream:disco_local_services(function (services)
 			for _, service in ipairs(services) do
-				for identity in pairs(stream.disco.cache[service.jid].identities) do
-					local category, type = identity:match("^(.*)/(.*)$");
-					stream:event("disco/service-discovered/"..category, {
-						type = type, jid = service.jid;
-					});
+				local service_disco_info = stream.disco.cache[service.jid];
+				if service_disco_info then
+					for identity in pairs(service_disco_info.identities) do
+						local category, type = identity:match("^(.*)/(.*)$");
+						stream:event("disco/service-discovered/"..category, {
+							type = type, jid = service.jid;
+						});
+					end
 				end
 			end
 			stream:event("ready");