From b43a731beb24dccf273aefc0e601841ea59b6fd4 Mon Sep 17 00:00:00 2001 From: meta7 Date: Thu, 12 Aug 2010 05:40:41 -0700 Subject: Fix a nullref exception in the prioritizer --- OpenSim/Region/Framework/Scenes/Prioritizer.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 8cd0160..c6db7af 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -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; -- cgit v1.1