Skip to content

Commit

Permalink
fix potential crash when trying to use the document session's user wh…
Browse files Browse the repository at this point in the history
…en the session is not found

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
  • Loading branch information
julien-nc authored and backportbot-nextcloud[bot] committed Jan 27, 2023
1 parent 1118c4a commit 6640ad2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/Controller/SessionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}

0 comments on commit 6640ad2

Please sign in to comment.