From 7659d67fdb40d34997725e31e2ea8c201aadbd95 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Mon, 14 May 2007 19:31:05 +0000 Subject: [PATCH] Added some sanity checks to AddViewerAgent to prevent duplicate addition (now attempts update). --- OpenSim.RegionServer/world/World.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs index 445df1d496..e89f8f44c1 100644 --- a/OpenSim.RegionServer/world/World.cs +++ b/OpenSim.RegionServer/world/World.cs @@ -561,11 +561,25 @@ namespace OpenSim.world } lock (Entities) { - this.Entities.Add(agentClient.AgentID, newAvatar); + if (!Entities.ContainsKey(agentClient.AgentID)) + { + this.Entities.Add(agentClient.AgentID, newAvatar); + } + else + { + Entities[agentClient.AgentID] = newAvatar; + } } lock (Avatars) { - this.Avatars.Add(agentClient.AgentID, newAvatar); + if (Avatars.ContainsKey(agentClient.AgentID)) + { + Avatars[agentClient.AgentID] = newAvatar; + } + else + { + this.Avatars.Add(agentClient.AgentID, newAvatar); + } } } catch (Exception e)