2003-03-21 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
authorAtsushi Eno <atsushieno@gmail.com>
Thu, 20 Mar 2003 18:11:44 +0000 (18:11 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Thu, 20 Mar 2003 18:11:44 +0000 (18:11 -0000)
* XmlNodeArrayList.cs, XmlNodeListChildren.cs : bugzilla #39920 fix.

svn path=/trunk/mcs/; revision=12707

mcs/class/System.XML/System.Xml/ChangeLog
mcs/class/System.XML/System.Xml/XmlNodeArrayList.cs
mcs/class/System.XML/System.Xml/XmlNodeListChildren.cs

index f511a123e74c175be50606d6182bdcbe32053550..c855de6ddebdf1f3ac7fac15cb182e2f7bcc5544 100644 (file)
@@ -1,3 +1,7 @@
+2003-03-21  Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+       * XmlNodeArrayList.cs, XmlNodeListChildren.cs : bugzilla #39920 fix.
+
 2003-03-19  Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
 
        * XmlDeclaration.cs : quick fix, not to use regex for set_Value.
index a62fd77f4014c168fb185b350311357ab3118505..d8993c53a215e2cecf25997c998fe20bd1e5453d 100644 (file)
@@ -30,6 +30,10 @@ namespace System.Xml
 
                public override XmlNode Item (int index)
                {
+                       // Return null if index is out of range. by  DOM design.
+                       if (index < 0 || _rgNodes.Count <= index)
+                               return null;
+
                        return (XmlNode) _rgNodes [index];
                }
        }
index c5d6282350371a6237cc5d109809bdc1592f9768..55c3919717d924e001928d7e181ee0322dcd0d98 100644 (file)
@@ -118,6 +118,10 @@ namespace System.Xml
                {
                        XmlNode requestedNode = null;
 
+                       // Return null if index is out of range. by  DOM design.
+                       if (Count <= index)
+                               return null;
+
                        // Instead of checking for && index < Count which has to walk
                        // the whole list to get a count, we'll just keep a count since
                        // we have to walk the list anyways to get to index.