Merge pull request #7 from jedateach/patch-1

Check if dataRecord is a SiteTree to prevent errors
This commit is contained in:
Jono Menz 2014-10-08 10:37:13 -06:00
commit 3b53e7b36a

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();
@ -61,4 +61,4 @@ class BetterNavigator extends DataExtension {
}
return false;
}
}
}