From af3118eccd0d471b748a1dd89e6899b51ae0332c Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 31 Mar 2008 17:08:58 +0000 Subject: * Fix problem where inventory code throws a swallowed exception on grid mode if the avatar has never logged in before --- .../Communications/InventoryServiceBase.cs | 50 ++++++++++++++-------- 1 file changed, 33 insertions(+), 17 deletions(-) (limited to 'OpenSim/Framework/Communications') diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index a0228e8..3187215 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs @@ -79,25 +79,41 @@ namespace OpenSim.Framework.Communications // See IInventoryServices public List GetInventorySkeleton(LLUUID userId) { - //m_log.DebugFormat("[AGENT INVENTORY]: Getting inventory skeleton for {0}", userId); - - List userFolders = new List(); - - InventoryFolderBase rootFolder = RequestRootFolder(userId); - userFolders.Add(rootFolder); - - foreach (KeyValuePair plugin in m_plugins) + try { - IList folders = plugin.Value.getFolderHierarchy(rootFolder.folderID); - userFolders.AddRange(folders); - } - -// foreach (InventoryFolderBase folder in userFolders) -// { -// m_log.DebugFormat("[AGENT INVENTORY]: Got folder {0} {1}", folder.name, folder.folderID); -// } + m_log.DebugFormat("[AGENT INVENTORY]: Getting inventory skeleton for {0}", userId); + + List userFolders = new List(); + + InventoryFolderBase rootFolder = RequestRootFolder(userId); + + // Agent is completely new and has no inventory structure yet. + if (null == rootFolder) + { + return null; + } + + userFolders.Add(rootFolder); + + foreach (KeyValuePair plugin in m_plugins) + { + IList folders = plugin.Value.getFolderHierarchy(rootFolder.folderID); + userFolders.AddRange(folders); + } + + // foreach (InventoryFolderBase folder in userFolders) + // { + // m_log.DebugFormat("[AGENT INVENTORY]: Got folder {0} {1}", folder.name, folder.folderID); + // } + + return userFolders; + } + catch (Exception e) + { + m_log.ErrorFormat("GetInventorySkeleton() exception {0}", e); + } - return userFolders; + return null; } // See IInventoryServices -- cgit v1.1