mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
do not die if there is no parent in RelativeLink
When resolving a relative link it can be that no valid parent node is reached ... handle this condition gracefully.
This commit is contained in:
parent
8e871460a8
commit
8bccac1d07
@ -519,7 +519,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
if((!$parent || !$parent->exists()) && $this->IsDeletedFromStage) {
|
if((!$parent || !$parent->exists()) && $this->IsDeletedFromStage) {
|
||||||
$parent = Versioned::get_latest_version('SiteTree', $this->ParentID);
|
$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()) {
|
} elseif(!$action && $this->URLSegment == RootURLController::get_homepage_link()) {
|
||||||
// Unset base for root-level homepages.
|
// Unset base for root-level homepages.
|
||||||
// Note: Homepages with action parameters (or $action === true)
|
// Note: Homepages with action parameters (or $action === true)
|
||||||
|
Loading…
Reference in New Issue
Block a user