[mono-api-html] Print string fields with no (or null) value without an NRE.
authorRolf Bjarne Kvinge <rolf@xamarin.com>
Fri, 25 Apr 2014 13:59:53 +0000 (15:59 +0200)
committerRolf Bjarne Kvinge <rolf@xamarin.com>
Fri, 25 Apr 2014 14:01:39 +0000 (16:01 +0200)
mcs/tools/corcompare/mono-api-html/FieldComparer.cs

index 54942b64043d5a95f942f6363930d65cfa656644..fd21e3fb27037133a25be4c87f266932159f56e0 100644 (file)
@@ -71,8 +71,12 @@ namespace Xamarin.ApiDiff {
                                string ftype = e.GetTypeName ("fieldtype");
                                sb.Append (ftype).Append (' ');
                                sb.Append (name);
-                               if (ftype == "string")
-                                       sb.Append (" = \"").Append (e.Attribute ("value").Value).Append ('"');
+                               if (ftype == "string" && e.Attribute ("value") != null) {
+                                       if (value == null)
+                                               sb.Append (" = null");
+                                       else
+                                               sb.Append (" = \"").Append (value).Append ('"');
+                               }
                                sb.Append (';');
                        }