FIX: If no parent in RelativeLink() return null

This commit is contained in:
Amol Wankhede 2019-12-04 17:08:49 +13:00
parent 3a028ac1ec
commit de96188c8a

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)