From 46b771a061d1201b2de974243666dac5feaad305 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Mon, 2 Dec 2019 22:28:47 +0300 Subject: [PATCH] Fixes ACCOUNTS-5VE --- api/components/User/OAuth2Identity.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/components/User/OAuth2Identity.php b/api/components/User/OAuth2Identity.php index bbb06cf..1b8b69b 100644 --- a/api/components/User/OAuth2Identity.php +++ b/api/components/User/OAuth2Identity.php @@ -41,6 +41,11 @@ class OAuth2Identity implements IdentityInterface { } public function getAccount(): ?Account { + $session = $this->getSession(); + if ($session === null) { + return null; + } + return $this->getSession()->account; } @@ -70,7 +75,7 @@ class OAuth2Identity implements IdentityInterface { // @codeCoverageIgnoreEnd - private function getSession(): OauthSession { + private function getSession(): ?OauthSession { return OauthSession::findOne(['id' => $this->_accessToken->getSessionId()]); }