diff --git a/core/model/SiteTree.php b/core/model/SiteTree.php index 3fed86725..5f1b67b31 100644 --- a/core/model/SiteTree.php +++ b/core/model/SiteTree.php @@ -777,7 +777,7 @@ class SiteTree extends DataObject { ''; $count = 1; - while(DataObject::get_one("SiteTree", "URLSegment = '$this->URLSegment' $idFilter")) { + while(class_exists($this->URLSegment) || DataObject::get_one("SiteTree", "URLSegment = '$this->URLSegment' $idFilter")) { $count++; $this->URLSegment = ereg_replace('-[0-9]+$','', $this->URLSegment) . "-$count"; }