diff options
| author | Claus Vium <cvium@users.noreply.github.com> | 2021-05-24 08:43:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-24 08:43:44 +0200 |
| commit | 1594385497fb7f8e7d12169db34c64821c73864f (patch) | |
| tree | ea81505d2416123aaedceb15dbc7bdbd5ed38276 | |
| parent | 45e27a3bc45f87267f39fdf5f8c65b0ce4ab9079 (diff) | |
| parent | f53aa55bdbcdf83c527648a9fc3c89191039ecd1 (diff) | |
Merge pull request #6038 from crobibero/delete-existing-sessions
Don't logout if deviceId is null
| -rw-r--r-- | Emby.Server.Implementations/Session/SessionManager.cs | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index ef467da7e..62df354fd 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -1542,23 +1542,26 @@ namespace Emby.Server.Implementations.Session Limit = 1 }).Items.FirstOrDefault(); - var allExistingForDevice = _authRepo.Get( - new AuthenticationInfoQuery - { - DeviceId = deviceId - }).Items; - - foreach (var auth in allExistingForDevice) + if (!string.IsNullOrEmpty(deviceId)) { - if (existing == null || !string.Equals(auth.AccessToken, existing.AccessToken, StringComparison.Ordinal)) - { - try + var allExistingForDevice = _authRepo.Get( + new AuthenticationInfoQuery { - Logout(auth); - } - catch (Exception ex) + DeviceId = deviceId + }).Items; + + foreach (var auth in allExistingForDevice) + { + if (existing == null || !string.Equals(auth.AccessToken, existing.AccessToken, StringComparison.Ordinal)) { - _logger.LogError(ex, "Error while logging out."); + try + { + Logout(auth); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error while logging out."); + } } } } |
