diff --git a/core/model/SiteTree.php b/core/model/SiteTree.php index dd15e6087..ddb19b0af 100644 --- a/core/model/SiteTree.php +++ b/core/model/SiteTree.php @@ -361,7 +361,7 @@ class SiteTree extends DataObject { self::$currentPageID = Director::currentPage() ? Director::currentPage()->ID : null; if(!isset(self::$currentPageID)) { self::$currentPageID = -1; - $nextID = isset(Director::currentPage()->Parent->ID) + $nextID = (Director::currentPage() && isset(Director::currentPage()->Parent->ID)) ? Director::currentPage()->Parent->ID : null; } else {