Skip to content

Commit f9e4811

Browse files
committed
Fix null error when deleting non-existent comment
1 parent 47211b7 commit f9e4811

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/templates/Comment/Delete.phtml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ switch ($this->getContext()->error) {
3232
$message = $this->getContext()->error;
3333
}
3434

35-
$c = $this->getContext()->comment;
36-
$c_id = $c->getId();
37-
$c_user = $c->getUser();
38-
$c_user_id = $c->getUserId();
39-
$c_user_name = $c_user->getName();
40-
$c_user_url = $c_user->getURI();
41-
$c_user_avatar = $c_user->getAvatarURI(22);
35+
$c = $this->getContext()->comment;
36+
if ($c) {
37+
$c_id = $c->getId();
38+
$c_user = $c->getUser();
39+
$c_user_id = $c->getUserId();
40+
$c_user_name = $c_user->getName();
41+
$c_user_url = $c_user->getURI();
42+
$c_user_avatar = $c_user->getAvatarURI(22);
43+
}
4244

4345
$this->additional_css[] = "/a/comments.css";
4446
$this->additional_css[] = "/a/forms.css";

0 commit comments

Comments
 (0)