diff options
| author | Bond_009 <bond.009@outlook.com> | 2022-12-05 15:00:20 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2022-12-05 15:00:20 +0100 |
| commit | c7d50d640e614a3c13699e3041fbfcb258861c5a (patch) | |
| tree | 85ce1a16c1af479160b805ec098463ae457b5228 /Jellyfin.Server.Implementations | |
| parent | b2def4c9ea6cf5e406bf5f865867d6cb5b54f640 (diff) | |
Replace == null with is null
Diffstat (limited to 'Jellyfin.Server.Implementations')
9 files changed, 15 insertions, 15 deletions
diff --git a/Jellyfin.Server.Implementations/Devices/DeviceManager.cs b/Jellyfin.Server.Implementations/Devices/DeviceManager.cs index eeb958c620..321a16d475 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; } diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStartLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStartLogger.cs index aa6015caae..bb98a6c342 100644 --- a/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStartLogger.cs +++ b/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStartLogger.cs @@ -38,7 +38,7 @@ namespace Jellyfin.Server.Implementations.Events.Consumers.Session /// <inheritdoc /> public async Task OnEvent(PlaybackStartEventArgs eventArgs) { - if (eventArgs.MediaInfo == null) + if (eventArgs.MediaInfo is null) { _logger.LogWarning("PlaybackStart reported with null media info."); return; diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStopLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStopLogger.cs index 1648b1b475..baa957390a 100644 --- a/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStopLogger.cs +++ b/Jellyfin.Server.Implementations/Events/Consumers/Session/PlaybackStopLogger.cs @@ -40,7 +40,7 @@ namespace Jellyfin.Server.Implementations.Events.Consumers.Session { var item = eventArgs.MediaInfo; - if (item == null) + if (item is null) { _logger.LogWarning("PlaybackStopped reported with null media info."); return; @@ -60,7 +60,7 @@ namespace Jellyfin.Server.Implementations.Events.Consumers.Session var user = eventArgs.Users[0]; var notificationType = GetPlaybackStoppedNotificationType(item.MediaType); - if (notificationType == null) + if (notificationType is null) { return; } diff --git a/Jellyfin.Server.Implementations/Events/EventManager.cs b/Jellyfin.Server.Implementations/Events/EventManager.cs index 7f7c4750d8..f49ae8e27a 100644 --- a/Jellyfin.Server.Implementations/Events/EventManager.cs +++ b/Jellyfin.Server.Implementations/Events/EventManager.cs @@ -44,7 +44,7 @@ namespace Jellyfin.Server.Implementations.Events where T : EventArgs { using var scope = _appHost.ServiceProvider?.CreateScope(); - if (scope == null) + if (scope is null) { return; } diff --git a/Jellyfin.Server.Implementations/Extensions/ServiceCollectionExtensions.cs b/Jellyfin.Server.Implementations/Extensions/ServiceCollectionExtensions.cs index f98a0aede8..05c6229316 100644 --- a/Jellyfin.Server.Implementations/Extensions/ServiceCollectionExtensions.cs +++ b/Jellyfin.Server.Implementations/Extensions/ServiceCollectionExtensions.cs @@ -27,7 +27,7 @@ public static class ServiceCollectionExtensions .UseCacheKeyPrefix("EF_") // Don't cache null values. Remove this optional setting if it's not necessary. .SkipCachingResults(result => - result.Value == null || (result.Value is EFTableRows rows && rows.RowsCount == 0))); + result.Value is null || (result.Value is EFTableRows rows && rows.RowsCount == 0))); serviceCollection.AddPooledDbContextFactory<JellyfinDb>((serviceProvider, opt) => { diff --git a/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs b/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs index 33c08c8c29..810e578075 100644 --- a/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs +++ b/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs @@ -65,7 +65,7 @@ namespace Jellyfin.Server.Implementations.Security .FirstOrDefaultAsync() .ConfigureAwait(false); - if (key == null) + if (key is null) { return; } diff --git a/Jellyfin.Server.Implementations/Users/DefaultAuthenticationProvider.cs b/Jellyfin.Server.Implementations/Users/DefaultAuthenticationProvider.cs index 7480a05c25..72f3d6e8ec 100644 --- a/Jellyfin.Server.Implementations/Users/DefaultAuthenticationProvider.cs +++ b/Jellyfin.Server.Implementations/Users/DefaultAuthenticationProvider.cs @@ -41,7 +41,7 @@ namespace Jellyfin.Server.Implementations.Users // This is the version that we need to use for local users. Because reasons. public Task<ProviderAuthenticationResult> Authenticate(string username, string password, User resolvedUser) { - if (resolvedUser == null) + if (resolvedUser is null) { throw new AuthenticationException("Specified user does not exist."); } @@ -58,7 +58,7 @@ namespace Jellyfin.Server.Implementations.Users } // Handle the case when the stored password is null, but the user tried to login with a password - if (resolvedUser.Password == null) + if (resolvedUser.Password is null) { throw new AuthenticationException("Invalid username or password"); } diff --git a/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs b/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs index 87babc05c8..fddad1c4f9 100644 --- a/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs +++ b/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs @@ -34,7 +34,7 @@ namespace Jellyfin.Server.Implementations.Users .FirstOrDefault(pref => pref.UserId.Equals(userId) && string.Equals(pref.Client, client) && pref.ItemId.Equals(itemId)); - if (prefs == null) + if (prefs is null) { prefs = new DisplayPreferences(userId, itemId, client); _dbContext.DisplayPreferences.Add(prefs); @@ -49,7 +49,7 @@ namespace Jellyfin.Server.Implementations.Users var prefs = _dbContext.ItemDisplayPreferences .FirstOrDefault(pref => pref.UserId.Equals(userId) && pref.ItemId.Equals(itemId) && string.Equals(pref.Client, client)); - if (prefs == null) + if (prefs is null) { prefs = new ItemDisplayPreferences(userId, Guid.Empty, client); _dbContext.ItemDisplayPreferences.Add(prefs); diff --git a/Jellyfin.Server.Implementations/Users/UserManager.cs b/Jellyfin.Server.Implementations/Users/UserManager.cs index 25560707ac..131853aed4 100644 --- a/Jellyfin.Server.Implementations/Users/UserManager.cs +++ b/Jellyfin.Server.Implementations/Users/UserManager.cs @@ -401,7 +401,7 @@ namespace Jellyfin.Server.Implementations.Users var authenticationProvider = authResult.AuthenticationProvider; var success = authResult.Success; - if (user == null) + if (user is null) { string updatedUsername = authResult.Username; @@ -434,7 +434,7 @@ namespace Jellyfin.Server.Implementations.Users } } - if (user == null) + if (user is null) { _logger.LogInformation( "Authentication request for {UserName} has been denied (IP: {IP}).", @@ -708,7 +708,7 @@ namespace Jellyfin.Server.Implementations.Users /// <inheritdoc/> public async Task ClearProfileImageAsync(User user) { - if (user.ProfileImage == null) + if (user.ProfileImage is null) { return; } |
