Skip to content

Commit 6808b30

Browse files
committed
prevent exception when impersonation with token by guest is not successful
1 parent 02e9dba commit 6808b30

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/controllers/UsersController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ public function actionImpersonateWithToken(int $userId, int $prevUserId): ?Respo
378378
if (!$success) {
379379
$this->setFailFlash(Craft::t('app', 'There was a problem impersonating this user.'));
380380
Craft::error(sprintf('%s tried to impersonate userId: %s but something went wrong.',
381-
$userSession->getIdentity()->username, $userId), __METHOD__);
381+
$userSession->getIdentity()?->username ?? 'Unknown user', $userId), __METHOD__);
382382
return null;
383383
}
384384

0 commit comments

Comments
 (0)