aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Capabilities
diff options
context:
space:
mode:
authorAdam Frisby2009-05-10 20:50:38 +0000
committerAdam Frisby2009-05-10 20:50:38 +0000
commit2d4166fecf556acf8866759b263636ca979b14e8 (patch)
tree52b2793bc8569db998cb520db493656b016856d8 /OpenSim/Framework/Communications/Capabilities
parent* Further testing against core packet issue. (diff)
downloadopensim-SC_OLD-2d4166fecf556acf8866759b263636ca979b14e8.zip
opensim-SC_OLD-2d4166fecf556acf8866759b263636ca979b14e8.tar.gz
opensim-SC_OLD-2d4166fecf556acf8866759b263636ca979b14e8.tar.bz2
opensim-SC_OLD-2d4166fecf556acf8866759b263636ca979b14e8.tar.xz
* Debugging some inventory related NullRefException's.
Diffstat (limited to 'OpenSim/Framework/Communications/Capabilities')
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs49
1 files changed, 29 insertions, 20 deletions
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
66 FieldInfo[] fields = myType.GetFields(); 66 FieldInfo[] fields = myType.GetFields();
67 for (int i = 0; i < fields.Length; i++) 67 for (int i = 0; i < fields.Length; i++)
68 { 68 {
69 object fieldValue = fields[i].GetValue(obj); 69 try
70 LLSDType[] fieldAttributes =
71 (LLSDType[]) fieldValue.GetType().GetCustomAttributes(typeof (LLSDType), false);
72 if (fieldAttributes.Length > 0)
73 { 70 {
74 writer.WriteStartElement(String.Empty, "key", String.Empty); 71 object fieldValue = fields[i].GetValue(obj);
75 string fieldName = fields[i].Name; 72 LLSDType[] fieldAttributes =
76 fieldName = fieldName.Replace("___", "-"); 73 (LLSDType[]) fieldValue.GetType().GetCustomAttributes(typeof (LLSDType), false);
77 writer.WriteString(fieldName); 74 if (fieldAttributes.Length > 0)
78 writer.WriteEndElement(); 75 {
79 SerializeOSDType(writer, fieldValue); 76 writer.WriteStartElement(String.Empty, "key", String.Empty);
80 } 77 string fieldName = fields[i].Name;
81 else 78 fieldName = fieldName.Replace("___", "-");
79 writer.WriteString(fieldName);
80 writer.WriteEndElement();
81 SerializeOSDType(writer, fieldValue);
82 }
83 else
84 {
85 writer.WriteStartElement(String.Empty, "key", String.Empty);
86 string fieldName = fields[i].Name;
87 fieldName = fieldName.Replace("___", "-");
88 writer.WriteString(fieldName);
89 writer.WriteEndElement();
90 LLSD.LLSDWriteOne(writer, fieldValue);
91 // OpenMetaverse.StructuredData.LLSDParser.SerializeXmlElement(
92 // writer, OpenMetaverse.StructuredData.OSD.FromObject(fieldValue));
93 }
94 } catch(NullReferenceException e)
82 { 95 {
83 writer.WriteStartElement(String.Empty, "key", String.Empty); 96 System.Console.WriteLine("-----------NRE-------------");
84 string fieldName = fields[i].Name; 97 System.Console.WriteLine("Type: " + fields[i].GetValue(obj).GetType().FullName);
85 fieldName = fieldName.Replace("___", "-"); 98 System.Console.WriteLine("-----------NRE-------------");
86 writer.WriteString(fieldName); 99 throw;
87 writer.WriteEndElement();
88 LLSD.LLSDWriteOne(writer, fieldValue);
89 // OpenMetaverse.StructuredData.LLSDParser.SerializeXmlElement(
90 // writer, OpenMetaverse.StructuredData.OSD.FromObject(fieldValue));
91 } 100 }
92 } 101 }
93 writer.WriteEndElement(); 102 writer.WriteEndElement();