Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

Commit 6cb1f05

Browse files
author
Jirka Koutny
committed
Better condition
1 parent 187b49e commit 6cb1f05

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

KernelExceptionListener.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ public function onKernelException(GetResponseForExceptionEvent $event)
2828
$exception = $event->getException();
2929

3030
if (Debugger::isEnabled() && !$this->isIgnoredException($exception)) {
31-
$this->storeUsernameInServerVariable();
31+
if ($this->storeUsernameInServerVariable && $this->tokenStorage !== null) {
32+
$this->storeUsernameInServerVariable();
33+
}
3234

3335
if (Debugger::$productionMode === true) {
3436
Debugger::log($exception, Debugger::ERROR);
@@ -56,9 +58,6 @@ private function isIgnoredException(Exception $exception)
5658

5759
private function storeUsernameInServerVariable()
5860
{
59-
if (null === $this->tokenStorage || !$this->storeUsernameInServerVariable) {
60-
return;
61-
}
6261
$token = $this->tokenStorage->getToken();
6362

6463
if ($token) {

0 commit comments

Comments
 (0)