Merge pull request #2504 from amolswnz/hotfix/2502

FIX: If no parent in RelativeLink() return null
This commit is contained in:
Serge Latyntsev 2019-12-05 10:18:59 +13:00 committed by GitHub
commit c127b30bcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -645,7 +645,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
if ((!$parent || !$parent->exists()) && !$this->isOnDraft()) {
$parent = Versioned::get_latest_version(self::class, $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)