mirror of
https://github.com/silverstripe/silverstripe-comments
synced 2024-10-22 09:05:49 +00:00
Prevent errors when comments' parent pages have been removed
This commit is contained in:
parent
df64d7d098
commit
2df8c2b1c3
@ -100,7 +100,9 @@ class Comment extends DataObject {
|
||||
* @return string link to this comment.
|
||||
*/
|
||||
public function Link($action = "") {
|
||||
return $this->getParent()->Link($action) . '#' . $this->Permalink();
|
||||
if($parent = $this->getParent()){
|
||||
return $parent->Link($action) . '#' . $this->Permalink();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -150,9 +152,9 @@ class Comment extends DataObject {
|
||||
* @return string
|
||||
*/
|
||||
public function getParentTitle() {
|
||||
$parent = $this->getParent();
|
||||
|
||||
if($parent = $this->getParent()){
|
||||
return ($parent && $parent->Title) ? $parent->Title : $parent->ClassName . " #" . $parent->ID;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user