From 2d4166fecf556acf8866759b263636ca979b14e8 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 10 May 2009 20:50:38 +0000 Subject: * Debugging some inventory related NullRefException's. --- .../Communications/Capabilities/LLSDHelpers.cs | 49 +++++++++++++--------- 1 file changed, 29 insertions(+), 20 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs index ae4a3db..ca68e85 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs @@ -66,28 +66,37 @@ namespace OpenSim.Framework.Communications.Capabilities FieldInfo[] fields = myType.GetFields(); for (int i = 0; i < fields.Length; i++) { - object fieldValue = fields[i].GetValue(obj); - LLSDType[] fieldAttributes = - (LLSDType[]) fieldValue.GetType().GetCustomAttributes(typeof (LLSDType), false); - if (fieldAttributes.Length > 0) + try { - writer.WriteStartElement(String.Empty, "key", String.Empty); - string fieldName = fields[i].Name; - fieldName = fieldName.Replace("___", "-"); - writer.WriteString(fieldName); - writer.WriteEndElement(); - SerializeOSDType(writer, fieldValue); - } - else + object fieldValue = fields[i].GetValue(obj); + LLSDType[] fieldAttributes = + (LLSDType[]) fieldValue.GetType().GetCustomAttributes(typeof (LLSDType), false); + if (fieldAttributes.Length > 0) + { + writer.WriteStartElement(String.Empty, "key", String.Empty); + string fieldName = fields[i].Name; + fieldName = fieldName.Replace("___", "-"); + writer.WriteString(fieldName); + writer.WriteEndElement(); + SerializeOSDType(writer, fieldValue); + } + else + { + writer.WriteStartElement(String.Empty, "key", String.Empty); + string fieldName = fields[i].Name; + fieldName = fieldName.Replace("___", "-"); + writer.WriteString(fieldName); + writer.WriteEndElement(); + LLSD.LLSDWriteOne(writer, fieldValue); + // OpenMetaverse.StructuredData.LLSDParser.SerializeXmlElement( + // writer, OpenMetaverse.StructuredData.OSD.FromObject(fieldValue)); + } + } catch(NullReferenceException e) { - writer.WriteStartElement(String.Empty, "key", String.Empty); - string fieldName = fields[i].Name; - fieldName = fieldName.Replace("___", "-"); - writer.WriteString(fieldName); - writer.WriteEndElement(); - LLSD.LLSDWriteOne(writer, fieldValue); - // OpenMetaverse.StructuredData.LLSDParser.SerializeXmlElement( - // writer, OpenMetaverse.StructuredData.OSD.FromObject(fieldValue)); + System.Console.WriteLine("-----------NRE-------------"); + System.Console.WriteLine("Type: " + fields[i].GetValue(obj).GetType().FullName); + System.Console.WriteLine("-----------NRE-------------"); + throw; } } writer.WriteEndElement(); -- cgit v1.1