Fix a nullref exception in the prioritizer

avinationmerge
meta7 2010-08-12 05:40:41 -07:00
parent df9521caf3
commit b43a731beb
1 changed files with 12 additions and 1 deletions

View File

@ -134,6 +134,7 @@ namespace OpenSim.Region.Framework.Scenes
private double GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity)
{
if (entity == null) return double.NaN;
ScenePresence presence = m_scene.GetScenePresence(client.AgentId);
if (presence != null)
{
@ -144,7 +145,17 @@ namespace OpenSim.Region.Framework.Scenes
// Use group position for child prims
Vector3 entityPos = entity.AbsolutePosition;
if (entity is SceneObjectPart)
entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
{
SceneObjectGroup group = m_scene.GetGroupByPrim(entity.LocalId);
if (group == null)
{
entityPos = entity.AbsolutePosition;
}
else
{
entityPos = group.AbsolutePosition;
}
}
else
entityPos = entity.AbsolutePosition;