mod_presence: Fixed a traceback.
authorWaqas Hussain <waqas20@gmail.com>
Wed, 9 Jun 2010 17:00:01 +0000 (22:00 +0500)
committerWaqas Hussain <waqas20@gmail.com>
Wed, 9 Jun 2010 17:00:01 +0000 (22:00 +0500)
plugins/mod_presence.lua

index 1380c5c68a73167192cf394664d1d20aa50ad6c4..3735cf1d957495d905ddafc84614c5c6f2aaa170 100644 (file)
@@ -273,7 +273,8 @@ local outbound_presence_handler = function(data)
                end
 
                local to_bare = jid_bare(to);
-               if not(origin.roster[to_bare] and (origin.roster[to_bare].subscription == "both" or origin.roster[to_bare].subscription == "from")) then -- directed presence
+               local roster = origin.roster;
+               if roster and not(roster[to_bare] and (roster[to_bare].subscription == "both" or roster[to_bare].subscription == "from")) then -- directed presence
                        origin.directed = origin.directed or {};
                        if t then -- removing from directed presence list on sending an error or unavailable
                                origin.directed[to] = nil; -- FIXME does it make more sense to add to_bare rather than to?