From: Tim Düsterhus Date: Mon, 17 May 2021 10:01:08 +0000 (+0200) Subject: Fix possible property access on `null` in `SessionHandler::applyPendingUserChange()` X-Git-Tag: 5.4.0_Alpha_3~32 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a13fa77a0922c7df192b8fdcfcfaee10dedba90c;p=GitHub%2FWoltLab%2FWCF.git Fix possible property access on `null` in `SessionHandler::applyPendingUserChange()` --- diff --git a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php index 3792bc7313..bdc00eb17b 100644 --- a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php +++ b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php @@ -917,14 +917,14 @@ final class SessionHandler extends SingletonFactory $user = $this->getPendingUserChange(); $this->clearPendingUserChange(); - if ($user->userID !== $expectedUser->userID) { - throw new \RuntimeException('Mismatching expectedUser.'); - } - if (!$user) { throw new \BadMethodCallException('No pending user change.'); } + if ($user->userID !== $expectedUser->userID) { + throw new \RuntimeException('Mismatching expectedUser.'); + } + $this->changeUser($user); }