Permalink
Browse files

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

…ts()
  • Loading branch information...
chillu committed Dec 20, 2011
1 parent 0d008b6 commit 1914f0b29dfdd965fcd863dfb56e00e45e681be6
Showing with 2 additions and 1 deletion.
  1. +2 −1 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

This comment has been minimized.

Show comment
Hide comment
@wolfv

wolfv Dec 21, 2011

Contributor

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;
}

Contributor

wolfv replied 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

This comment has been minimized.

Show comment
Hide comment
@chillu

chillu Dec 29, 2011

Member

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

Member

chillu replied Dec 29, 2011

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

Please sign in to comment.