Merge pull request #2260 from oetiker/patch-1

do not die if there is no parent in RelativeLink
This commit is contained in:
Robbie Averill 2018-10-03 13:35:49 +02:00 committed by GitHub
commit 338c512e15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -519,7 +519,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
if((!$parent || !$parent->exists()) && $this->IsDeletedFromStage) {
$parent = Versioned::get_latest_version('SiteTree', $this->ParentID);
}
$base = $parent->RelativeLink($this->URLSegment);
$base = $parent ? $parent->RelativeLink($this->URLSegment) : null;
} elseif(!$action && $this->URLSegment == RootURLController::get_homepage_link()) {
// Unset base for root-level homepages.
// Note: Homepages with action parameters (or $action === true)