aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-06-25 18:55:20 +0100
committerJustin Clark-Casey (justincc)2010-06-25 18:55:20 +0100
commit52b711af824eff047f8e65139cf7bdfb150f270f (patch)
tree98c4e4da300f5666aa49435e5bfb836c5e5204ff /OpenSim
parentminor: Move log information about SYSTEMIP to the place where it's resolved (diff)
downloadopensim-SC-52b711af824eff047f8e65139cf7bdfb150f270f.zip
opensim-SC-52b711af824eff047f8e65139cf7bdfb150f270f.tar.gz
opensim-SC-52b711af824eff047f8e65139cf7bdfb150f270f.tar.bz2
opensim-SC-52b711af824eff047f8e65139cf7bdfb150f270f.tar.xz
stop KeyNotFoundException() being thrown in RemoveScenePresence if the agent isn't present in the presence dictionary
the code to do this was there but was being circumvented by newmap[agentID] before the check actually took place
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs13
1 files changed, 7 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 673674d..240c688 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -599,7 +599,7 @@ namespace OpenSim.Region.Framework.Scenes
599 if (!Entities.Remove(agentID)) 599 if (!Entities.Remove(agentID))
600 { 600 {
601 m_log.WarnFormat( 601 m_log.WarnFormat(
602 "[SCENE] Tried to remove non-existent scene presence with agent ID {0} from scene Entities list", 602 "[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list",
603 agentID); 603 agentID);
604 } 604 }
605 605
@@ -607,12 +607,13 @@ namespace OpenSim.Region.Framework.Scenes
607 { 607 {
608 Dictionary<UUID, ScenePresence> newmap = new Dictionary<UUID, ScenePresence>(m_scenePresenceMap); 608 Dictionary<UUID, ScenePresence> newmap = new Dictionary<UUID, ScenePresence>(m_scenePresenceMap);
609 List<ScenePresence> newlist = new List<ScenePresence>(m_scenePresenceArray); 609 List<ScenePresence> newlist = new List<ScenePresence>(m_scenePresenceArray);
610 610
611 // Remember the old presene reference from the dictionary
612 ScenePresence oldref = newmap[agentID];
613 // Remove the presence reference from the dictionary 611 // Remove the presence reference from the dictionary
614 if (newmap.Remove(agentID)) 612 if (newmap.ContainsKey(agentID))
615 { 613 {
614 ScenePresence oldref = newmap[agentID];
615 newmap.Remove(agentID);
616
616 // Find the index in the list where the old ref was stored and remove the reference 617 // Find the index in the list where the old ref was stored and remove the reference
617 newlist.RemoveAt(newlist.IndexOf(oldref)); 618 newlist.RemoveAt(newlist.IndexOf(oldref));
618 // Swap out the dictionary and list with new references 619 // Swap out the dictionary and list with new references
@@ -621,7 +622,7 @@ namespace OpenSim.Region.Framework.Scenes
621 } 622 }
622 else 623 else
623 { 624 {
624 m_log.WarnFormat("[SCENE] Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID); 625 m_log.WarnFormat("[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
625 } 626 }
626 } 627 }
627 } 628 }