Try to cache system folders if they aren't already there when one is requested

This operation can be performed legitimately on standalones without a logged in user
remotes/origin/0.6.7-post-fixes
Justin Clark-Casey (justincc) 2009-08-28 17:19:45 +01:00
parent 7ff4c2e50b
commit 18c5dc0953
1 changed files with 13 additions and 0 deletions

View File

@ -145,6 +145,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
m_InventoryCache.Remove(userID);
}
/// <summary>
/// Get the system folder for a particular asset type
/// </summary>
/// <param name="userID"></param>
/// <param name="type"></param>
/// <returns></returns>
public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
{
Dictionary<AssetType, InventoryFolderBase> folders = null;
@ -152,6 +158,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
lock (m_InventoryCache)
{
m_InventoryCache.TryGetValue(userID, out folders);
// In some situations (such as non-secured standalones), system folders can be requested without
// the user being logged in. So we need to try caching them here if we don't already have them.
if (null == folders)
CacheSystemFolders(userID);
m_InventoryCache.TryGetValue(userID, out folders);
}
if ((folders != null) && folders.ContainsKey(type))