Fix broken go to last post link
authorMarcel Werk <burntime@woltlab.com>
Fri, 17 Nov 2023 14:29:00 +0000 (15:29 +0100)
committerMarcel Werk <burntime@woltlab.com>
Fri, 17 Nov 2023 14:29:00 +0000 (15:29 +0100)
The link led to an error message if the conversation did not contain any messages visible for the user.

files/lib/page/ConversationPage.class.php

index fe520b14eeb17b1a1aa988972d7709994e786e88..97b9f46c3846bb7876e5f1834fd6f9dc131f1e24 100644 (file)
@@ -212,8 +212,7 @@ class ConversationPage extends MultipleLinkPage
         // update last visit time count
         if (
             $this->conversation->isNew()
-            && (
-                $this->objectList->getMaxPostTime() > $this->conversation->lastVisitTime
+            && ($this->objectList->getMaxPostTime() > $this->conversation->lastVisitTime
                 || ($this->conversation->joinedAt && !\count($this->objectList))
             )
         ) {
@@ -383,6 +382,10 @@ class ConversationPage extends MultipleLinkPage
         $statement = WCF::getDB()->prepareStatement($sql, 1);
         $statement->execute($this->objectList->getConditionBuilder()->getParameters());
         $row = $statement->fetchArray();
+        if ($row === false) {
+            return;
+        }
+
         HeaderUtil::redirect(
             LinkHandler::getInstance()->getLink(
                 'Conversation',