Fixed error when news comments category doesn't exist somehow.
This commit is contained in:
parent
e3c0ae662e
commit
a89d8d26f4
1 changed files with 6 additions and 3 deletions
|
@ -126,9 +126,12 @@ final class NewsHandler extends Handler {
|
||||||
|
|
||||||
$comments = $this->context->getComments();
|
$comments = $this->context->getComments();
|
||||||
|
|
||||||
if($postInfo->hasCommentsCategoryId()) {
|
if($postInfo->hasCommentsCategoryId())
|
||||||
|
try {
|
||||||
$commentsCategory = $comments->getCategoryById($postInfo->getCommentsCategoryId());
|
$commentsCategory = $comments->getCategoryById($postInfo->getCommentsCategoryId());
|
||||||
} else {
|
} catch(RuntimeException $ex) {}
|
||||||
|
|
||||||
|
if(!isset($commentsCategory)) {
|
||||||
$commentsCategory = $comments->ensureCategory($postInfo->getCommentsCategoryName());
|
$commentsCategory = $comments->ensureCategory($postInfo->getCommentsCategoryName());
|
||||||
$news->updatePostCommentCategory($postInfo, $commentsCategory);
|
$news->updatePostCommentCategory($postInfo, $commentsCategory);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue