From 2b7419c7fb55449e47560afcaf54e02bf982b749 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Mon, 14 Apr 2008 03:20:36 +0000 Subject: #952 again --- .../Region/Environment/Modules/FriendsModule.cs | 28 ++++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs index a6d44ee..a2ec599 100644 --- a/OpenSim/Region/Environment/Modules/FriendsModule.cs +++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs @@ -88,6 +88,9 @@ namespace OpenSim.Region.Environment.Modules client.OnTerminateFriendship += OnTerminateFriendship; List fl = new List(); + + //bool addFLback = false; + lock (FriendLists) { if (FriendLists.ContainsKey(client.AgentId)) @@ -97,11 +100,12 @@ namespace OpenSim.Region.Environment.Modules else { fl = m_scene[0].GetFriendList(client.AgentId); - lock (FriendLists) - { + + //lock (FriendLists) + //{ if (!FriendLists.ContainsKey(client.AgentId)) FriendLists.Add(client.AgentId, fl); - } + //} } } @@ -200,11 +204,21 @@ namespace OpenSim.Region.Environment.Modules for (int i = 0; i < updateUsers.Count; i++) { List flfli = new List(); - - lock (FriendLists) + try + { + + lock (FriendLists) + { + if (FriendLists.ContainsKey(updateUsers[i])) + flfli = FriendLists[updateUsers[i]]; + } + } + catch (IndexOutOfRangeException) { - if (FriendLists.ContainsKey(updateUsers[i])) - flfli = FriendLists[updateUsers[i]]; + // Ignore the index out of range exception. + // This causes friend lists to get out of sync slightly.. however + // prevents a sim crash. + m_log.Info("[FRIEND]: Unable to enumerate last friendlist user. User logged off"); } for (int j = 0; j < flfli.Count; j++) -- cgit v1.1