Use null coalescing when possible

This commit is contained in:
crobibero
2020-11-13 11:24:46 -07:00
parent 5f52a58e78
commit 95ebb9a55a
13 changed files with 22 additions and 110 deletions

View File

@@ -57,12 +57,8 @@ namespace Jellyfin.Server.Implementations.Users
SerializablePasswordReset? spr;
await using (var str = File.OpenRead(resetFile))
{
spr = await JsonSerializer.DeserializeAsync<SerializablePasswordReset>(str).ConfigureAwait(false);
}
if (spr == null)
{
throw new ResourceNotFoundException(nameof(spr));
spr = await JsonSerializer.DeserializeAsync<SerializablePasswordReset>(str).ConfigureAwait(false)
?? throw new ResourceNotFoundException(nameof(spr));
}
if (spr.ExpirationDate < DateTime.UtcNow)