From 64c9ce8d35845f50e8c84fdae587818efb20c13f Mon Sep 17 00:00:00 2001 From: Atsushi Eno Date: Fri, 21 Apr 2017 22:52:54 +0900 Subject: [PATCH] [javadoc-to-mdoc] workaround Java6 annotation parsing failure. Docs for Java6 annotations are not parsed as expected and causing crash as https://bugzilla.xamarin.com/show_bug.cgi?id=55402 states. Since we are not going to seriously work on Java6 documentation parser, we just workaround the null issue. --- src/Xamarin.Android.Tools.JavadocImporter/DocumentSection.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Xamarin.Android.Tools.JavadocImporter/DocumentSection.cs b/src/Xamarin.Android.Tools.JavadocImporter/DocumentSection.cs index 6aee6bc1e13..3030f73bfa0 100644 --- a/src/Xamarin.Android.Tools.JavadocImporter/DocumentSection.cs +++ b/src/Xamarin.Android.Tools.JavadocImporter/DocumentSection.cs @@ -317,6 +317,9 @@ abstract class JavaDocDocumentSection : DocumentSection public JavaDocDocumentSection (XElement sectionNode) { + if (sectionNode == null) + return; // Any derived classes might pass null element here. Since we cannot reject it here, we ignore the entire section. + section_node = sectionNode; foreach (XElement pp in section_node.XPathSelectElements (".//dl/dt")) { var b = pp.XPathSelectElement (SectionNameWrapperTag); @@ -428,6 +431,8 @@ public override string SectionNameWrapperTag { public override IEnumerable GetSummaryNodes () { + if (section_node == null) + return Enumerable.Empty (); var sumDL = section_node.Elements (XName.Get ("dd")).FirstOrDefault (); return sumDL == null ? Enumerable.Empty () : sumDL.Nodes ().TakeWhile (n => !(n is XElement && ((XElement)n).Name.LocalName != "dl"))