diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6c1d434575..66d1e4f8b4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1648,15 +1648,19 @@ namespace OpenSim.Region.Framework.Scenes private void CheckAtTargets() { - List objs = new List(); + List objs = null; + lock (m_groupsWithTargets) { - foreach (SceneObjectGroup grp in m_groupsWithTargets.Values) - objs.Add(grp); + if (m_groupsWithTargets.Count != 0) + objs = new List(m_groupsWithTargets.Values); } - foreach (SceneObjectGroup entry in objs) - entry.checkAtTargets(); + if (objs != null) + { + foreach (SceneObjectGroup entry in objs) + entry.checkAtTargets(); + } } ///