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.
0.7.4-extended
Oren Hurvitz 2012-10-21 15:58:01 +02:00 committed by Justin Clark-Casey (justincc)
parent 7caf21c8a8
commit 16349c1368
1 changed files with 10 additions and 1 deletions

View File

@ -219,9 +219,15 @@ namespace OpenSim.Services.InventoryService
XInventoryFolder root = null; XInventoryFolder root = null;
foreach (XInventoryFolder folder in folders) foreach (XInventoryFolder folder in folders)
{
if (folder.folderName == "My Inventory") if (folder.folderName == "My Inventory")
{
root = folder; root = folder;
if (folders == null) // oops break;
}
}
if (root == null) // oops
root = folders[0]; root = folders[0];
return ConvertToOpenSim(root); 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); // 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( XInventoryFolder[] folders = m_Database.GetFolders(
new string[] { "agentID", "parentFolderID", "type"}, new string[] { "agentID", "parentFolderID", "type"},
new string[] { rootFolder.Owner.ToString(), rootFolder.ID.ToString(), ((int)type).ToString() }); new string[] { rootFolder.Owner.ToString(), rootFolder.ID.ToString(), ((int)type).ToString() });