From 83267e19f634b7957ceb2f9b0e2009fa0f8340a3 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 4 Jun 2015 16:17:45 -0700 Subject: Mantis #7536. This may alleviate the side effects of broken SceneObjects XML. It doesn't (can't) fix the cause. --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 35 ++++++++++++---------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 4961309..b4fcf8f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2222,6 +2222,8 @@ namespace OpenSim.Region.Framework.Scenes { objlist = new List(); veclist = new List(); + bbox = Vector3.Zero; + offsetHeight = 0; string xmlData = Utils.BytesToString(assetData); @@ -2237,9 +2239,12 @@ namespace OpenSim.Region.Framework.Scenes if (isSingleObject || isAttachment) { SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(reader); - objlist.Add(g); - veclist.Add(Vector3.Zero); - bbox = g.GetAxisAlignedBoundingBox(out offsetHeight); + if (g != null) + { + objlist.Add(g); + veclist.Add(Vector3.Zero); + bbox = g.GetAxisAlignedBoundingBox(out offsetHeight); + } return true; } else @@ -2258,17 +2263,20 @@ namespace OpenSim.Region.Framework.Scenes foreach (XmlNode n in groups) { SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml); - objlist.Add(g); + if (g != null) + { + objlist.Add(g); - XmlElement el = (XmlElement)n; - string rawX = el.GetAttribute("offsetx"); - string rawY = el.GetAttribute("offsety"); - string rawZ = el.GetAttribute("offsetz"); + XmlElement el = (XmlElement)n; + string rawX = el.GetAttribute("offsetx"); + string rawY = el.GetAttribute("offsety"); + string rawZ = el.GetAttribute("offsetz"); - float x = Convert.ToSingle(rawX); - float y = Convert.ToSingle(rawY); - float z = Convert.ToSingle(rawZ); - veclist.Add(new Vector3(x, y, z)); + float x = Convert.ToSingle(rawX); + float y = Convert.ToSingle(rawY); + float z = Convert.ToSingle(rawZ); + veclist.Add(new Vector3(x, y, z)); + } } return false; @@ -2281,9 +2289,6 @@ namespace OpenSim.Region.Framework.Scenes m_log.Error( "[AGENT INVENTORY]: Deserialization of xml failed when looking for CoalescedObject tag. Exception ", e); - - bbox = Vector3.Zero; - offsetHeight = 0; } return true; -- cgit v1.1