From edc64b45ffaab16c200bd33296ec9cc7560b68e1 Mon Sep 17 00:00:00 2001 From: flashwave Date: Sun, 10 Sep 2023 21:04:10 +0000 Subject: [PATCH] Fixed error when trying to view a non-existent topic when logged out. --- public-legacy/forum/topic.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/public-legacy/forum/topic.php b/public-legacy/forum/topic.php index bd3e727..519e9c1 100644 --- a/public-legacy/forum/topic.php +++ b/public-legacy/forum/topic.php @@ -65,17 +65,19 @@ if(!$topicIsNuked) { $canDeleteAny = $perms->check(Perm::F_POST_DELETE_ANY); } -if(($topicIsNuked || $topicIsDeleted) && $forumTopicRedirects->hasTopicRedirect($topicId)) { - $topicRedirectInfo = $forumTopicRedirects->getTopicRedirect($topicId); - Template::set('topic_redir_info', $topicRedirectInfo); +if($topicIsNuked || $topicIsDeleted) { + if($forumTopicRedirects->hasTopicRedirect($topicId)) { + $topicRedirectInfo = $forumTopicRedirects->getTopicRedirect($topicId); + Template::set('topic_redir_info', $topicRedirectInfo); - if($topicIsNuked || !$canDeleteAny) { - if(empty($topicRedirectInfo)) - Template::throwError(404); - - header('Location: ' . $topicRedirectInfo->getLinkTarget()); - return; + if($topicIsNuked || !$canDeleteAny) { + header('Location: ' . $topicRedirectInfo->getLinkTarget()); + return; + } } + + if(empty($topicRedirectInfo)) + Template::throwError(404); } if(!$perms->check(Perm::F_CATEGORY_VIEW))