Skip to content

Commit 1030888

Browse files
Code review
ISSUE: CR-SET-45
1 parent 408b932 commit 1030888

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/Util/RivertyDeviceFingerprintParamsProvider.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,13 @@ public function getSessionId(): string
9191
*/
9292
public function getExistingSessionId(): ?string
9393
{
94-
$sessionId = $this->getSession()?->get(self::SESSION_ID_SESSION_KEY);
94+
$session = $this->getSession();
95+
96+
if (is_null($session)) {
97+
return null;
98+
}
99+
100+
$sessionId = $session->get(self::SESSION_ID_SESSION_KEY);
95101

96102
return empty($sessionId) ? null : (string)$sessionId;
97103
}
@@ -103,7 +109,11 @@ public function getExistingSessionId(): ?string
103109
*/
104110
public function clear(): void
105111
{
106-
$this->getSession()?->remove(self::SESSION_ID_SESSION_KEY);
112+
$session = $this->getSession();
113+
114+
if (!is_null($session)) {
115+
$session->remove(self::SESSION_ID_SESSION_KEY);
116+
}
107117
}
108118

109119
/**

0 commit comments

Comments
 (0)