Related to #4689 - Adding missing null check for SceneObjectPart

Signed-off-by: BlueWall <jamesh@bluewallgroup.com>
bulletsim
Makopoppo 2011-08-27 12:16:46 +09:00 committed by BlueWall
parent d4d894c20f
commit 795b56e695
2 changed files with 18 additions and 4 deletions

View File

@ -223,6 +223,8 @@ namespace OpenSim.Region.Framework.Scenes
// Retrieve group // Retrieve group
SceneObjectPart part = GetSceneObjectPart(primId); SceneObjectPart part = GetSceneObjectPart(primId);
if (part == null)
return new ArrayList();
SceneObjectGroup group = part.ParentGroup; SceneObjectGroup group = part.ParentGroup;
if (null == group) if (null == group)
{ {
@ -967,6 +969,8 @@ namespace OpenSim.Region.Framework.Scenes
public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID) public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID)
{ {
SceneObjectPart part = GetSceneObjectPart(localID); SceneObjectPart part = GetSceneObjectPart(localID);
if (part == null)
return;
SceneObjectGroup group = part.ParentGroup; SceneObjectGroup group = part.ParentGroup;
if (group != null) if (group != null)
{ {
@ -2028,6 +2032,8 @@ namespace OpenSim.Region.Framework.Scenes
foreach (uint localID in localIDs) foreach (uint localID in localIDs)
{ {
SceneObjectPart part = GetSceneObjectPart(localID); SceneObjectPart part = GetSceneObjectPart(localID);
if (part == null)
continue;
if (!groups.Contains(part.ParentGroup)) if (!groups.Contains(part.ParentGroup))
groups.Add(part.ParentGroup); groups.Add(part.ParentGroup);
} }
@ -2073,6 +2079,8 @@ namespace OpenSim.Region.Framework.Scenes
foreach (uint localID in localIDs) foreach (uint localID in localIDs)
{ {
SceneObjectPart part = GetSceneObjectPart(localID); SceneObjectPart part = GetSceneObjectPart(localID);
if (part == null)
continue;
part.GetProperties(remoteClient); part.GetProperties(remoteClient);
} }
} }

View File

@ -1546,11 +1546,14 @@ namespace OpenSim.Region.Framework.Scenes
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
{ {
SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID); SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID);
if (part != null)
{
part.ClickAction = Convert.ToByte(clickAction); part.ClickAction = Convert.ToByte(clickAction);
group.HasGroupChanged = true; group.HasGroupChanged = true;
} }
} }
} }
}
protected internal void PrimMaterial(IClientAPI remoteClient, uint primLocalID, string material) protected internal void PrimMaterial(IClientAPI remoteClient, uint primLocalID, string material)
{ {
@ -1560,11 +1563,14 @@ namespace OpenSim.Region.Framework.Scenes
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
{ {
SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID); SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID);
if (part != null)
{
part.Material = Convert.ToByte(material); part.Material = Convert.ToByte(material);
group.HasGroupChanged = true; group.HasGroupChanged = true;
} }
} }
} }
}
protected internal void UpdateExtraParam(UUID agentID, uint primLocalID, ushort type, bool inUse, byte[] data) protected internal void UpdateExtraParam(UUID agentID, uint primLocalID, ushort type, bool inUse, byte[] data)
{ {