aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaus Vium <cvium@users.noreply.github.com>2021-05-24 08:43:44 +0200
committerJoshua M. Boniface <joshua@boniface.me>2021-05-27 02:46:02 -0400
commitd2db73b8767dce821e54720039845073a841d243 (patch)
treec15801a89faa5130c9a94c7888548d373be6fc1e
parent49873c3d7f79d62be06247878f4b892d282bf1be (diff)
Merge pull request #6038 from crobibero/delete-existing-sessions
Don't logout if deviceId is null (cherry picked from commit 1594385497fb7f8e7d12169db34c64821c73864f) Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
-rw-r--r--Emby.Server.Implementations/Session/SessionManager.cs31
1 files changed, 17 insertions, 14 deletions
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs
index 10e28c33a..30e2d49da 100644
--- a/Emby.Server.Implementations/Session/SessionManager.cs
+++ b/Emby.Server.Implementations/Session/SessionManager.cs
@@ -1543,23 +1543,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.");
+ }
}
}
}