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.prebuild-update
parent
87a6554d4b
commit
a6869fbc3e
|
@ -122,9 +122,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// Use group position for child prims
|
// Use group position for child prims
|
||||||
Vector3 entityPos;
|
Vector3 entityPos;
|
||||||
if (entity is SceneObjectPart)
|
if (entity is SceneObjectPart)
|
||||||
entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
|
{
|
||||||
|
// Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene
|
||||||
|
// before its scheduled update was triggered
|
||||||
|
//entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
|
||||||
|
entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
entityPos = entity.AbsolutePosition;
|
entityPos = entity.AbsolutePosition;
|
||||||
|
}
|
||||||
|
|
||||||
return Vector3.DistanceSquared(presencePos, entityPos);
|
return Vector3.DistanceSquared(presencePos, entityPos);
|
||||||
}
|
}
|
||||||
|
@ -144,9 +151,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// Use group position for child prims
|
// Use group position for child prims
|
||||||
Vector3 entityPos = entity.AbsolutePosition;
|
Vector3 entityPos = entity.AbsolutePosition;
|
||||||
if (entity is SceneObjectPart)
|
if (entity is SceneObjectPart)
|
||||||
entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
|
{
|
||||||
|
// Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene
|
||||||
|
// before its scheduled update was triggered
|
||||||
|
//entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
|
||||||
|
entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
entityPos = entity.AbsolutePosition;
|
entityPos = entity.AbsolutePosition;
|
||||||
|
}
|
||||||
|
|
||||||
if (!presence.IsChildAgent)
|
if (!presence.IsChildAgent)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue