From bf8f64e40eb0766de1f671bf05f985e422761ea8 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Mon, 12 May 2014 08:54:31 +0300 Subject: Fixed error if a user didn't have a "Current Outfit" folder in their suitcase. This fixes http://opensimulator.org/mantis/view.php?id=7161 --- .../HypergridService/HGSuitcaseInventoryService.cs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index 3de2330..4416995 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs @@ -122,7 +122,7 @@ namespace OpenSim.Services.HypergridService } List tree = GetFolderTree(principalID, suitcase.folderID); - if (tree == null || (tree != null && tree.Count == 0)) + if (tree.Count == 0) return null; List folders = new List(); @@ -537,13 +537,13 @@ namespace OpenSim.Services.HypergridService private List GetFolderTree(UUID principalID, UUID folder) { - List t = null; + List t; if (m_SuitcaseTrees.TryGetValue(principalID, out t)) return t; // Get the tree of the suitcase folder t = GetFolderTreeRecursive(folder); - m_SuitcaseTrees.AddOrUpdate(principalID, t, 5*60); // 5minutes + m_SuitcaseTrees.AddOrUpdate(principalID, t, 5*60); // 5 minutes return t; } @@ -554,8 +554,10 @@ namespace OpenSim.Services.HypergridService new string[] { "parentFolderID" }, new string[] { root.ToString() }); - if (folders == null || (folders != null && folders.Length == 0)) + if (folders == null || folders.Length == 0) + { return tree; // empty tree + } else { foreach (XInventoryFolder f in folders) @@ -588,17 +590,18 @@ namespace OpenSim.Services.HypergridService List tree = new List(); tree.Add(suitcase); // Warp! the tree is the real root folder plus the children of the suitcase folder tree.AddRange(GetFolderTree(principalID, suitcase.folderID)); + // Also add the Current Outfit folder to the list of available folders - tree.Add(GetCurrentOutfitXFolder(principalID)); + XInventoryFolder folder = GetCurrentOutfitXFolder(principalID); + if (folder != null) + tree.Add(folder); XInventoryFolder f = tree.Find(delegate(XInventoryFolder fl) { - if (fl.folderID == folderID) return true; - else return false; + return (fl.folderID == folderID); }); - if (f == null) return false; - else return true; + return (f != null); } #endregion -- cgit v1.1