Fixed empty xmlDocument reverse formatting issue.

This commit is contained in:
Matteo Tomasini 2011-04-05 11:17:46 +02:00
parent e7c1ad698e
commit 0dadf51bac

View file

@ -412,7 +412,7 @@ namespace ScrewTurn.Wiki {
public static string ReverseFormat(string html) { public static string ReverseFormat(string html) {
StringReader strReader = new StringReader(html); StringReader strReader = new StringReader(html);
XmlDocument x = FromHTML((TextReader)strReader); XmlDocument x = FromHTML((TextReader)strReader);
if(x != null) return ProcessChild(x.FirstChild.ChildNodes); if(x != null && x.HasChildNodes && x.FirstChild.HasChildNodes) return ProcessChild(x.FirstChild.ChildNodes);
else return ""; else return "";
} }
} }