diff options
author | Nick Zigarovich <nickziga@mono-cvs.ximian.com> | 2002-10-14 10:22:08 +0400 |
---|---|---|
committer | Nick Zigarovich <nickziga@mono-cvs.ximian.com> | 2002-10-14 10:22:08 +0400 |
commit | bad23e8a2905ce1c65424c337841cbf016124ef0 (patch) | |
tree | 177fced6a1e7e7364bb7dddc103801e8cf1d4586 /mcs/class/System.XML/System.Xml | |
parent | d0579aba6b1cb4b8180a11039d107e3f2b795bc9 (diff) |
Make sure XmlTextReader.GetAttribute never returns null.
svn path=/trunk/mcs/; revision=8237
Diffstat (limited to 'mcs/class/System.XML/System.Xml')
-rw-r--r-- | mcs/class/System.XML/System.Xml/XmlTextReader.cs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/mcs/class/System.XML/System.Xml/XmlTextReader.cs b/mcs/class/System.XML/System.Xml/XmlTextReader.cs index ded97250cbb..b51eb6ff3dc 100644 --- a/mcs/class/System.XML/System.Xml/XmlTextReader.cs +++ b/mcs/class/System.XML/System.Xml/XmlTextReader.cs @@ -330,7 +330,8 @@ namespace System.Xml public override string GetAttribute (string name) { - return attributes [name] as string; + return attributes.ContainsKey (name) ? + attributes [name] as string : String.Empty; } public override string GetAttribute (string localName, string namespaceURI) @@ -349,10 +350,12 @@ namespace System.Xml string thisNamespaceURI = LookupNamespace (thisPrefix); if (namespaceURI == thisNamespaceURI) - return attributes [thisName] as string; + return attributes.ContainsKey (thisName) ? + attributes [thisName] as string : String.Empty; } } else if (localName == "xmlns" && namespaceURI == "http://www.w3.org/2000/xmlns/" && thisName == "xmlns") - return attributes [thisName] as string; + return attributes.ContainsKey (thisName) ? + attributes [thisName] as string : String.Empty; } return String.Empty; |