From f10bcc50718a43c389489de10c7655d63309286a Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Mon, 3 Aug 2009 04:45:00 +0000 Subject: [PATCH] 2009-08-03 Miguel de Icaza * Extensions.cs: Add a null guard and return null on failure, instead of crashing. svn path=/trunk/mcs/; revision=139263 --- mcs/class/System.Xml.Linq/System.Xml.XPath/Extensions.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mcs/class/System.Xml.Linq/System.Xml.XPath/Extensions.cs b/mcs/class/System.Xml.Linq/System.Xml.XPath/Extensions.cs index a035b99f9fa..578d6ece517 100644 --- a/mcs/class/System.Xml.Linq/System.Xml.XPath/Extensions.cs +++ b/mcs/class/System.Xml.Linq/System.Xml.XPath/Extensions.cs @@ -63,6 +63,8 @@ namespace System.Xml.XPath public static XElement XPathSelectElement (this XNode node, string xpath, IXmlNamespaceResolver nsResolver) { XPathNavigator nav = CreateNavigator (node).SelectSingleNode (xpath, nsResolver); + if (nav == null) + return null; return nav.UnderlyingObject as XElement; } -- 2.11.4.GIT