diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index 12f19ccb..59b3481c 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -250,7 +250,8 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr if($defaultChild != 'Page' && $defaultChild != null) $def[$class]['defaultChild'] = $defaultChild; - $id = SiteTree::get_by_link($obj->defaultParent())->ID; + $defaultParent = $obj->defaultParent(); + $id = $defaultParent ? SiteTree::get_by_link($defaultParent)->ID : null; $defaultParent = $id ? SiteTree::get_by_link($obj->defaultParent())->ID : null; if ($defaultParent != 1 && $defaultParent != null) $def[$class]['defaultParent'] = $defaultParent;