From 6640ad287a6636ec14b517a5b6b01e97883ef88a Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Fri, 27 Jan 2023 12:28:07 +0100 Subject: [PATCH] fix potential crash when trying to use the document session's user when the session is not found Signed-off-by: Julien Veyssier --- lib/Controller/SessionController.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Controller/SessionController.php b/lib/Controller/SessionController.php index 9c6b66d5849..fb4c5116e97 100644 --- a/lib/Controller/SessionController.php +++ b/lib/Controller/SessionController.php @@ -113,9 +113,11 @@ public function mention(int $documentId, int $sessionId, string $sessionToken, s private function loginSessionUser(int $documentId, int $sessionId, string $sessionToken) { $currentSession = $this->sessionService->getSession($documentId, $sessionId, $sessionToken); - $user = $this->userManager->get($currentSession->getUserId()); - if ($user !== null) { - $this->userSession->setUser($user); + if ($currentSession !== false) { + $user = $this->userManager->get($currentSession->getUserId()); + if ($user !== null) { + $this->userSession->setUser($user); + } } } }