From c7af4d8bf50f45b3b7bdd1450e1e8e87c62c8ca1 Mon Sep 17 00:00:00 2001
From: Waqas Hussain <waqas20@gmail.com>
Date: Wed, 9 Jun 2010 22:00:01 +0500
Subject: mod_presence: Fixed a traceback.

---
 plugins/mod_presence.lua | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'plugins')

diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua
index 1380c5c6..3735cf1d 100644
--- a/plugins/mod_presence.lua
+++ b/plugins/mod_presence.lua
@@ -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?
-- 
cgit v1.2.3