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
bullet-2.82
Oren Hurvitz 2014-05-12 08:54:31 +03:00
parent 73891c7fd3
commit bf8f64e40e
1 changed files with 12 additions and 9 deletions

View File

@ -122,7 +122,7 @@ namespace OpenSim.Services.HypergridService
} }
List<XInventoryFolder> tree = GetFolderTree(principalID, suitcase.folderID); List<XInventoryFolder> tree = GetFolderTree(principalID, suitcase.folderID);
if (tree == null || (tree != null && tree.Count == 0)) if (tree.Count == 0)
return null; return null;
List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
@ -537,7 +537,7 @@ namespace OpenSim.Services.HypergridService
private List<XInventoryFolder> GetFolderTree(UUID principalID, UUID folder) private List<XInventoryFolder> GetFolderTree(UUID principalID, UUID folder)
{ {
List<XInventoryFolder> t = null; List<XInventoryFolder> t;
if (m_SuitcaseTrees.TryGetValue(principalID, out t)) if (m_SuitcaseTrees.TryGetValue(principalID, out t))
return t; return t;
@ -554,8 +554,10 @@ namespace OpenSim.Services.HypergridService
new string[] { "parentFolderID" }, new string[] { "parentFolderID" },
new string[] { root.ToString() }); new string[] { root.ToString() });
if (folders == null || (folders != null && folders.Length == 0)) if (folders == null || folders.Length == 0)
{
return tree; // empty tree return tree; // empty tree
}
else else
{ {
foreach (XInventoryFolder f in folders) foreach (XInventoryFolder f in folders)
@ -588,17 +590,18 @@ namespace OpenSim.Services.HypergridService
List<XInventoryFolder> tree = new List<XInventoryFolder>(); List<XInventoryFolder> tree = new List<XInventoryFolder>();
tree.Add(suitcase); // Warp! the tree is the real root folder plus the children of the suitcase folder tree.Add(suitcase); // Warp! the tree is the real root folder plus the children of the suitcase folder
tree.AddRange(GetFolderTree(principalID, suitcase.folderID)); tree.AddRange(GetFolderTree(principalID, suitcase.folderID));
// Also add the Current Outfit folder to the list of available folders // 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) XInventoryFolder f = tree.Find(delegate(XInventoryFolder fl)
{ {
if (fl.folderID == folderID) return true; return (fl.folderID == folderID);
else return false;
}); });
if (f == null) return false; return (f != null);
else return true;
} }
#endregion #endregion