plugins/disco.lua

changeset 146
2678048e93e6
parent 121
9b31ac5a37ea
child 167
a2ae7a9d360f
--- 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");

mercurial