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 ++++++++++++++++++++++ .../Region/Environment/Scenes/Scene.Inventory.cs | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'OpenSim') 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; + } } /// diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 0ab8779..53ae28f 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -371,7 +371,7 @@ namespace OpenSim.Region.Environment.Scenes itemCopy.Name = item.Name; itemCopy.AssetType = item.AssetType; itemCopy.InvType = item.InvType; - itemCopy.Folder = recipientUserInfo.RootFolder.ID; + itemCopy.Folder = LLUUID.Zero; if (ExternalChecks.ExternalChecksPropagatePermissions()) { if (item.InvType == 6) -- cgit v1.1