From ad3349ccc952ec45877a2f80d9bd24a7d3a3010a Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Mon, 6 Jul 2009 03:12:53 +0000 Subject: [PATCH] BUGFIX: prevented cms from dying when a page has no published children. Added check before stepping into the loop git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@81050 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/Hierarchy.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/model/Hierarchy.php b/core/model/Hierarchy.php index e34ba771e..4d8217885 100644 --- a/core/model/Hierarchy.php +++ b/core/model/Hierarchy.php @@ -171,9 +171,11 @@ class Hierarchy extends DataObjectDecorator { */ protected function markingFinished() { // Mark childless nodes as expanded. - foreach($this->markedNodes as $id => $node) { - if(!$node->isExpanded() && !$node->numChildren()) { - $node->markExpanded(); + if($this->markedNodes) { + foreach($this->markedNodes as $id => $node) { + if(!$node->isExpanded() && !$node->numChildren()) { + $node->markExpanded(); + } } } }