Only query last comment info, when there is one

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/9272/head
Joas Schilling 2018-04-23 11:50:30 +07:00
parent 3ff041f86d
commit 446efa4625
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
1 changed files with 2 additions and 2 deletions

@ -407,11 +407,11 @@ class Manager implements ICommentsManager {
$query->setMaxResults($limit);
}
$lastKnownComment = $this->getLastKnownComment(
$lastKnownComment = $lastKnownCommentId > 0 ? $this->getLastKnownComment(
$objectType,
$objectId,
$lastKnownCommentId
);
) : null;
if ($lastKnownComment instanceof IComment) {
$lastKnownCommentDateTime = $lastKnownComment->getCreationDateTime();
if ($sortDirection === 'desc') {