* Monodoc/provider.cs: Revert; Don't check for Tree.Nodes == null, as it
authorJonathan Pryor <jpryor@novell.com>
Thu, 26 Feb 2009 18:24:25 +0000 (18:24 -0000)
committerJonathan Pryor <jpryor@novell.com>
Thu, 26 Feb 2009 18:24:25 +0000 (18:24 -0000)
  happens in numerous places.  Instead, take a page out of the "I
  never should have invented `null'" book, and ensure that Tree.Nodes
  can never be null.  This fixes the "HelpSource has 0 items" issue
  and several other related ones.

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

mcs/tools/monodoc/ChangeLog
mcs/tools/monodoc/Monodoc/provider.cs

index 43faca90d903fa09e388315fbef189c5bb6d5211..261bf0b738cdc100b449e710b95a83347f5fbcba 100644 (file)
@@ -1,3 +1,11 @@
+2009-02-26  Jonathan Pryor  <jonpryor@vt.edu>
+
+       * Monodoc/provider.cs: Revert; Don't check for Tree.Nodes == null, as it
+         happens in numerous places.  Instead, take a page out of the "I
+         never should have invented `null'" book, and ensure that Tree.Nodes
+         can never be null.  This fixes the "HelpSource has 0 items" issue
+         and several other related ones.
+
 2009-02-26  Jonathan Pryor  <jonpryor@vt.edu>
 
        * Monodoc/provider.cs: It's possible for a HelpSource to have 0
index 2522f60100f8a648f960fbf805a25fbba5f5d8d4..176fc4b516cab1c2793e2910d7639ecf08a7ece3 100644 (file)
@@ -126,6 +126,8 @@ public class Node : IComparable {
        protected ArrayList nodes;
        protected internal int position;
 
+       static ArrayList empty = ArrayList.ReadOnly(new ArrayList(0));
+
        /// <summary>
        ///    Creates a node, called by the Tree.
        /// </summary>
@@ -173,7 +175,7 @@ public class Node : IComparable {
                get {
                        if (position < 0)
                                LoadNode ();
-                       return nodes;
+                       return nodes != null ? nodes : empty;
                }
        }
 
@@ -892,9 +894,6 @@ public class RootTree : Tree {
                                        parent = third_party;
                                }
 
-                               if (hs.Tree.Nodes == null)
-                                       continue;
-
                                foreach (Node n in hs.Tree.Nodes){
                                        parent.AddNode (n);
                                }