Skip to content
Browse files

MINOR Checking for existence of defaultParent in CMSMain->SiteTreeHin…

…ts()
  • Loading branch information...
1 parent 0d008b6 commit 1914f0b29dfdd965fcd863dfb56e00e45e681be6 @chillu chillu committed Dec 20, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 code/controllers/CMSMain.php
View
3 code/controllers/CMSMain.php
@@ -250,7 +250,8 @@ public function SiteTreeHints() {
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;

2 comments on commit 1914f0b

@wolfv
wolfv commented on 1914f0b Dec 21, 2011

Does not do the job... Breaks.
Maybe this?

if(SiteTree::get_by_link($defaultParent)) {
$id = $defaultParent ? SiteTree::get_by_link($defaultParent)->ID : null;
$defaultParent = $id ? SiteTree::get_by_link($obj->defaultParent())->ID : null;
}

@chillu
SilverStripe Ltd. member
chillu commented on 1914f0b Dec 29, 2011

Good catch! The first line after the change shouldn't be there, fixed in ee2c800

Please sign in to comment.
Something went wrong with that request. Please try again.