From 780630d7c05f7306ffceb52db0eda1401112f426 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 23 Apr 2010 14:41:20 +0200 Subject: Fix a nullref in attachment handling. Add some debug to find the attachment state issue --- OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 3 ++- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 1 + OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 1 + OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 6 ++++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 354994b..a667b80 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -271,7 +271,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) { InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); - item = m_scene.InventoryService.GetItem(item); + if (m_scene.InventoryService != null) + item = m_scene.InventoryService.GetItem(item); presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); } diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index e6e414f..44fd2e1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1628,6 +1628,7 @@ namespace OpenSim.Region.Framework.Scenes remoteClient.AgentId); AssetService.Store(asset); + m_log.DebugFormat("[ScriptState]: Saved attachment as asset {0}", asset.FullID); item.AssetID = asset.FullID; item.Description = asset.Description; item.Name = asset.Name; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 84c3719..1f8c732 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -612,6 +612,7 @@ namespace OpenSim.Region.Framework.Scenes { UUID itemid = new UUID(node.Attributes["UUID"].Value); m_savedScriptState.Add(itemid, node.InnerXml); + m_log.DebugFormat("[ScriptState]: Retrieved state for script item ID {0}", itemid.ToString()); } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 04df35a..ce4802d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -333,8 +333,10 @@ namespace OpenSim.Region.Framework.Scenes if (engines == null) // No engine at all return; + m_log.DebugFormat("[ScriptState]: Item ID changed: {0} to {1}", oldID, newID); if (m_part.ParentGroup.m_savedScriptState.ContainsKey(oldID)) { + m_log.DebugFormat("[ScriptState]: Found script state for {0}, applying to new script item {1}", oldID, newID); XmlDocument doc = new XmlDocument(); doc.LoadXml(m_part.ParentGroup.m_savedScriptState[oldID]); @@ -380,6 +382,10 @@ namespace OpenSim.Region.Framework.Scenes } m_part.ParentGroup.m_savedScriptState.Remove(oldID); } + else + { + m_log.DebugFormat("[ScriptState]: No state for old ID {0}", oldID); + } } /// -- cgit v1.1