From b865249b8ceea6c72f467f35304c9c0eabd65240 Mon Sep 17 00:00:00 2001 From: morphw Date: Fri, 11 May 2007 19:24:09 +0000 Subject: [PATCH] Guard against re-adding an existing folder. Seemed to happen on some timeout cases. --- OpenSim.Framework/AgentInventory.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/OpenSim.Framework/AgentInventory.cs b/OpenSim.Framework/AgentInventory.cs index 35c27d9ea0..57ee7d9cba 100644 --- a/OpenSim.Framework/AgentInventory.cs +++ b/OpenSim.Framework/AgentInventory.cs @@ -77,14 +77,17 @@ namespace OpenSim.Framework.Inventory public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parent) { - Console.WriteLine("creating new folder called " + folderName + " in agents inventory"); - InventoryFolder Folder = new InventoryFolder(); - Folder.FolderID = folderID; - Folder.OwnerID = this.AgentID; - Folder.DefaultType = type; - Folder.FolderName = folderName; - Folder.ParentID = parent; - this.InventoryFolders.Add(Folder.FolderID, Folder); + if (!this.InventoryFolders.ContainsKey(folderID)) + { + Console.WriteLine("creating new folder called " + folderName + " in agents inventory"); + InventoryFolder Folder = new InventoryFolder(); + Folder.FolderID = folderID; + Folder.OwnerID = this.AgentID; + Folder.DefaultType = type; + Folder.FolderName = folderName; + Folder.ParentID = parent; + this.InventoryFolders.Add(Folder.FolderID, Folder); + } return (true); }