Don't logout if deviceId is null.

This commit is contained in:
crobibero 2021-05-12 13:32:54 -06:00
parent 6f3bd59aac
commit f53aa55bdb

View File

@ -1540,23 +1540,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))
var allExistingForDevice = _authRepo.Get(
new AuthenticationInfoQuery
{
DeviceId = deviceId
}).Items;
foreach (var auth in allExistingForDevice)
{
try
if (existing == null || !string.Equals(auth.AccessToken, existing.AccessToken, StringComparison.Ordinal))
{
Logout(auth);
}
catch (Exception ex)
{
_logger.LogError(ex, "Error while logging out.");
try
{
Logout(auth);
}
catch (Exception ex)
{
_logger.LogError(ex, "Error while logging out.");
}
}
}
}