Просмотр исходного кода

2007-03-28 Igor Zelmanovich <[email protected]>

	* Menu.cs:
	* TreeView:
	avoid Exception if HierarchicalDataSourceView.Select() returns null.

svn path=/trunk/mcs/; revision=75073
Igor Zelmanovich 19 лет назад
Родитель
Сommit
f9c2c8d33f

+ 6 - 0
mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog

@@ -1,3 +1,9 @@
+2007-03-28 Igor Zelmanovich <[email protected]>
+
+	* Menu.cs:
+	* TreeView:
+	avoid Exception if HierarchicalDataSourceView.Select() returns null.
+
 2007-03-22 Igor Zelmanovich <[email protected]>
 
 	* ObjectDataSource.cs:

+ 4 - 1
mcs/class/System.Web/System.Web.UI.WebControls/Menu.cs

@@ -856,7 +856,10 @@ namespace System.Web.UI.WebControls
 			EnsureChildControlsDataBound ();
 		}
 
-		private void FillBoundChildrenRecursive (IHierarchicalEnumerable hEnumerable, MenuItemCollection itemCollection) {
+		private void FillBoundChildrenRecursive (IHierarchicalEnumerable hEnumerable, MenuItemCollection itemCollection)
+		{
+			if (hEnumerable == null)
+				return;
 			foreach (object obj in hEnumerable) {
 				IHierarchyData hdata = hEnumerable.GetHierarchyData (obj);
 				MenuItem item = new MenuItem ();

+ 4 - 1
mcs/class/System.Web/System.Web.UI.WebControls/TreeView.cs

@@ -979,7 +979,10 @@ namespace System.Web.UI.WebControls
 			FillBoundChildrenRecursive (e, Nodes);
 		}
 		
-		private void FillBoundChildrenRecursive (IHierarchicalEnumerable hEnumerable, TreeNodeCollection nodeCollection) {
+		private void FillBoundChildrenRecursive (IHierarchicalEnumerable hEnumerable, TreeNodeCollection nodeCollection)
+		{
+			if (hEnumerable == null)
+				return;
 			foreach (object obj in hEnumerable) {
 				IHierarchyData hdata = hEnumerable.GetHierarchyData (obj);
 				TreeNode child = new TreeNode ();