From 0eeb56c61d0d6ae1b0291033920e27528d0e8167 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Wed, 20 Feb 2008 23:31:33 +0000 Subject: * Properly guard against the possibility that CopyInventoryItem doesn't get an asset back from the cache --- .../Region/Environment/Scenes/Scene.Inventory.cs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index a759173..e41f180 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -316,12 +316,23 @@ namespace OpenSim.Region.Environment.Scenes return; } } + + AssetBase asset + = AssetCache.GetAsset( + item.assetID, (item.assetType == (int)AssetType.Texture ? true : false)); - // TODO: preserve current permissions? - CreateNewInventoryItem( - remoteClient, newFolderID, callbackID, - AssetCache.GetAsset(item.assetID, (item.assetType == (int)AssetType.Texture ? true : false)), - item.inventoryNextPermissions); + if (asset != null) + { + // TODO: preserve current permissions? + CreateNewInventoryItem( + remoteClient, newFolderID, callbackID, asset, item.inventoryNextPermissions); + } + else + { + m_log.ErrorFormat( + "[AGENT INVENTORY]: Could not copy item {0} since asset {1} could not be found", + item.inventoryName, item.assetID); + } } private AssetBase CreateAsset(string name, string description, sbyte invType, sbyte assetType, byte[] data) -- cgit v1.1