diff options
author | Justin Clark-Casey (justincc) | 2010-08-26 15:33:42 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-08-26 15:33:42 +0100 |
commit | a6869fbc3ef92733de37f6dc95d62f08034dae17 (patch) | |
tree | 604705f0fdacbe20b429cd0f612ee27e621d9567 | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-a6869fbc3ef92733de37f6dc95d62f08034dae17.zip opensim-SC_OLD-a6869fbc3ef92733de37f6dc95d62f08034dae17.tar.gz opensim-SC_OLD-a6869fbc3ef92733de37f6dc95d62f08034dae17.tar.bz2 opensim-SC_OLD-a6869fbc3ef92733de37f6dc95d62f08034dae17.tar.xz |
Use SOP.ParentGroup in Prioritizer instead of Scene.GetGroupByPrim()
By the time a scheduled update is triggered, a sog may have been removed from the scene. This change prevents NullReferenceExceptions in these situations.
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Prioritizer.cs | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index de3c360..505d01f 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs | |||
@@ -122,9 +122,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
122 | // Use group position for child prims | 122 | // Use group position for child prims |
123 | Vector3 entityPos; | 123 | Vector3 entityPos; |
124 | if (entity is SceneObjectPart) | 124 | if (entity is SceneObjectPart) |
125 | entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; | 125 | { |
126 | // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene | ||
127 | // before its scheduled update was triggered | ||
128 | //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; | ||
129 | entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; | ||
130 | } | ||
126 | else | 131 | else |
132 | { | ||
127 | entityPos = entity.AbsolutePosition; | 133 | entityPos = entity.AbsolutePosition; |
134 | } | ||
128 | 135 | ||
129 | return Vector3.DistanceSquared(presencePos, entityPos); | 136 | return Vector3.DistanceSquared(presencePos, entityPos); |
130 | } | 137 | } |
@@ -144,9 +151,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
144 | // Use group position for child prims | 151 | // Use group position for child prims |
145 | Vector3 entityPos = entity.AbsolutePosition; | 152 | Vector3 entityPos = entity.AbsolutePosition; |
146 | if (entity is SceneObjectPart) | 153 | if (entity is SceneObjectPart) |
147 | entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; | 154 | { |
155 | // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene | ||
156 | // before its scheduled update was triggered | ||
157 | //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; | ||
158 | entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; | ||
159 | } | ||
148 | else | 160 | else |
161 | { | ||
149 | entityPos = entity.AbsolutePosition; | 162 | entityPos = entity.AbsolutePosition; |
163 | } | ||
150 | 164 | ||
151 | if (!presence.IsChildAgent) | 165 | if (!presence.IsChildAgent) |
152 | { | 166 | { |