Check if dataRecord is a SiteTree to prevent errors

This commit is contained in:
Jeremy Shipman 2014-10-06 15:19:56 +13:00
parent 8fedcf0c21
commit 90ae32dc51

View File

@ -26,7 +26,7 @@ class BetterNavigator extends DataExtension {
$isDev = Director::isDev();
if($isDev || Permission::check('CMS_ACCESS_CMSMain') || Permission::check('VIEW_DRAFT_CONTENT')) {
if($this->owner && $this->owner->dataRecord) {
if($this->owner && $this->owner->dataRecord && $this->owner->dataRecord instanceof SiteTree) {
//Get SilverStripeNavigator links & stage info (CMS/Stage/Live/Archive)
$nav = array();