diff options
| author | Shadowghost <Ghost_of_Stone@web.de> | 2022-12-07 17:40:24 +0100 |
|---|---|---|
| committer | Shadowghost <Ghost_of_Stone@web.de> | 2022-12-07 17:40:24 +0100 |
| commit | 2c86bd1875e6e85d5867618e992d850453dae663 (patch) | |
| tree | 671070fb246fd3821bf6f1e58a01c402a2f969d1 /Jellyfin.Server.Implementations/Devices/DeviceManager.cs | |
| parent | dd5f90802e71083347b6095eb79a9de0b9d34615 (diff) | |
| parent | 3cb7fe50127b1a8158186b390836ee25ae5a50fd (diff) | |
Merge branch 'master' into network-rewrite
Diffstat (limited to 'Jellyfin.Server.Implementations/Devices/DeviceManager.cs')
| -rw-r--r-- | Jellyfin.Server.Implementations/Devices/DeviceManager.cs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/Jellyfin.Server.Implementations/Devices/DeviceManager.cs b/Jellyfin.Server.Implementations/Devices/DeviceManager.cs index eeb958c62..15ac5c668 100644 --- a/Jellyfin.Server.Implementations/Devices/DeviceManager.cs +++ b/Jellyfin.Server.Implementations/Devices/DeviceManager.cs @@ -55,7 +55,7 @@ namespace Jellyfin.Server.Implementations.Devices await using (dbContext.ConfigureAwait(false)) { deviceOptions = await dbContext.DeviceOptions.AsQueryable().FirstOrDefaultAsync(dev => dev.DeviceId == deviceId).ConfigureAwait(false); - if (deviceOptions == null) + if (deviceOptions is null) { deviceOptions = new DeviceOptions(deviceId); dbContext.DeviceOptions.Add(deviceOptions); @@ -121,7 +121,7 @@ namespace Jellyfin.Server.Implementations.Devices .ConfigureAwait(false); } - var deviceInfo = device == null ? null : ToDeviceInfo(device); + var deviceInfo = device is null ? null : ToDeviceInfo(device); return deviceInfo; } @@ -139,12 +139,12 @@ namespace Jellyfin.Server.Implementations.Devices devices = devices.Where(device => device.UserId.Equals(query.UserId.Value)); } - if (query.DeviceId != null) + if (query.DeviceId is not null) { devices = devices.Where(device => device.DeviceId == query.DeviceId); } - if (query.AccessToken != null) + if (query.AccessToken is not null) { devices = devices.Where(device => device.AccessToken == query.AccessToken); } @@ -222,11 +222,7 @@ namespace Jellyfin.Server.Implementations.Devices public bool CanAccessDevice(User user, string deviceId) { ArgumentNullException.ThrowIfNull(user); - - if (string.IsNullOrEmpty(deviceId)) - { - throw new ArgumentNullException(nameof(deviceId)); - } + ArgumentException.ThrowIfNullOrEmpty(deviceId); if (user.HasPermission(PermissionKind.EnableAllDevices) || user.HasPermission(PermissionKind.IsAdministrator)) { |
