diff options
author | Justin Clark-Casey (justincc) | 2010-06-25 18:55:20 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-06-25 18:57:58 +0100 |
commit | 24785e82a5e3501155ab96d860feb8a4c0753ffd (patch) | |
tree | 0c84898e274b6a8e1b37216a51d2a5006c7d3df9 /OpenSim/Region/Framework | |
parent | * SimianAssetServiceConnector Delete() was expecting the wrong type of respon... (diff) | |
download | opensim-SC_OLD-24785e82a5e3501155ab96d860feb8a4c0753ffd.zip opensim-SC_OLD-24785e82a5e3501155ab96d860feb8a4c0753ffd.tar.gz opensim-SC_OLD-24785e82a5e3501155ab96d860feb8a4c0753ffd.tar.bz2 opensim-SC_OLD-24785e82a5e3501155ab96d860feb8a4c0753ffd.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/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 13 |
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 | } |