From 01b5425a2dc4e7675db9fceebc693479b37890ca Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Mon, 19 May 2008 20:05:10 +0000 Subject: Thank you kindly, Melanie for a patch that avoids a null ref in inventory give and also now causes items to appear in the correct folders now, no longer in the root folder. --- .../Communications/Cache/CachedUserInfo.cs | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'OpenSim/Framework/Communications/Cache') diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index f40f078..1cbffc7 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs @@ -485,6 +485,14 @@ namespace OpenSim.Framework.Communications.Cache { if (HasInventory) { + if(item.Folder == LLUUID.Zero) + { + InventoryFolderImpl f=FindFolderForType(item.AssetType); + if(f != null) + item.Folder=f.ID; + else + item.Folder=RootFolder.ID; + } ItemReceive(item); m_commsManager.InventoryService.AddItem(item); } @@ -606,6 +614,22 @@ namespace OpenSim.Framework.Communications.Cache return true; } } + + private InventoryFolderImpl FindFolderForType(int type) + { + if(RootFolder == null) + return null; + + lock(RootFolder.SubFolders) + { + foreach (InventoryFolderImpl f in RootFolder.SubFolders.Values) + { + if(f.Type == type) + return f; + } + } + return null; + } } /// -- cgit v1.1