BUGFIX Count() call on a non-object in File::BackLinkTrackingCount()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@109079 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2010-08-09 04:00:15 +00:00 committed by Sam Minnee
parent a699ff1a75
commit 58ce293347

View File

@ -169,7 +169,12 @@ class File extends DataObject {
* @return Integer
*/
function BackLinkTrackingCount() {
return $this->BackLinkTracking()->Count();
$pages = $this->BackLinkTracking();
if($pages) {
return $pages->Count();
} else {
return 0;
}
}
/**
@ -194,7 +199,8 @@ class File extends DataObject {
protected function onAfterDelete() {
parent::onAfterDelete();
if($brokenPages = $this->BackLinkTracking()) {
$brokenPages = $this->BackLinkTracking();
if($brokenPages) {
$origStage = Versioned::current_stage();
// This will syncLinkTracking on draft