From 16349c136897d77a5aa5b643fe72fc32b55241fd Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Sun, 21 Oct 2012 15:58:01 +0200 Subject: [PATCH] Fixed bugs when getting the root folder. 1. The error checking for the case where there's no "My Inventory" folder was incorrect: it checked the wrong variable. 2. If GetSystemFolderForType() is called to get AssetType.RootFolder then it should return the root folder immediately; not look for another root folder below it. --- .../Services/InventoryService/XInventoryService.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 00faa440d5..7bad4b00ec 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -219,9 +219,15 @@ namespace OpenSim.Services.InventoryService XInventoryFolder root = null; foreach (XInventoryFolder folder in folders) + { if (folder.folderName == "My Inventory") + { root = folder; - if (folders == null) // oops + break; + } + } + + if (root == null) // oops root = folders[0]; return ConvertToOpenSim(root); @@ -249,6 +255,9 @@ namespace OpenSim.Services.InventoryService { // m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); + if (type == AssetType.RootFolder) + return rootFolder; + XInventoryFolder[] folders = m_Database.GetFolders( new string[] { "agentID", "parentFolderID", "type"}, new string[] { rootFolder.Owner.ToString(), rootFolder.ID.ToString(), ((int)type).ToString() });