refactor: Move sanity checks to the top of IAM.RezObject() to make the code more readable

remove-scene-viewer
Justin Clark-Casey (justincc) 2011-09-01 23:14:50 +01:00
parent e30651b931
commit 712d44635a
1 changed files with 257 additions and 261 deletions

View File

@ -700,20 +700,31 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
RayStart, RayEnd, RayTargetID, Quaternion.Identity, RayStart, RayEnd, RayTargetID, Quaternion.Identity,
BypassRayCast, bRayEndIsIntersection, true, scale, false); BypassRayCast, bRayEndIsIntersection, true, scale, false);
// Rez object
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = m_Scene.InventoryService.GetItem(item); item = m_Scene.InventoryService.GetItem(item);
if (item != null) if (item == null)
{ {
item.Owner = remoteClient.AgentId; m_log.WarnFormat(
"[InventoryAccessModule]: Could not find item {0} for {1} in RezObject()",
itemID, remoteClient.Name);
return null;
}
item.Owner = remoteClient.AgentId;
AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString());
SceneObjectGroup group = null; if (rezAsset == null)
if (rezAsset != null)
{ {
m_log.WarnFormat(
"[InventoryAccessModule]: Could not find asset {0} for item {1} {2} for {3} in RezObject()",
item.AssetID, item.Name, item.ID, remoteClient.Name);
return null;
}
SceneObjectGroup group = null;
UUID itemId = UUID.Zero; UUID itemId = UUID.Zero;
// If we have permission to copy then link the rezzed object back to the user inventory // If we have permission to copy then link the rezzed object back to the user inventory
@ -953,24 +964,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
} }
} }
} }
}
else
{
m_log.WarnFormat(
"[InventoryAccessModule]: Could not find asset {0} for item {1} {2} for {3} in RezObject()", item.AssetID, item.Name, item.ID, remoteClient.Name);
}
return group; return group;
} }
else
{
m_log.WarnFormat(
"[InventoryAccessModule]: Could not find item {0} for {1} in RezObject()",
itemID, remoteClient.Name);
}
return null;
}
protected void AddUserData(SceneObjectGroup sog) protected void AddUserData(SceneObjectGroup sog)
{ {