From 57b1e93411a19f1f6ea95131bdbeea4f9765df89 Mon Sep 17 00:00:00 2001 From: crobibero Date: Fri, 13 Nov 2020 08:32:24 -0700 Subject: [PATCH] Fix nullability errors in Jellyfin.Server.Implementations --- .../Users/DefaultPasswordResetProvider.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Jellyfin.Server.Implementations/Users/DefaultPasswordResetProvider.cs b/Jellyfin.Server.Implementations/Users/DefaultPasswordResetProvider.cs index 6cb13cd23..ced25524e 100644 --- a/Jellyfin.Server.Implementations/Users/DefaultPasswordResetProvider.cs +++ b/Jellyfin.Server.Implementations/Users/DefaultPasswordResetProvider.cs @@ -54,12 +54,17 @@ namespace Jellyfin.Server.Implementations.Users var usersReset = new List(); foreach (var resetFile in Directory.EnumerateFiles(_passwordResetFileBaseDir, $"{BaseResetFileName}*")) { - SerializablePasswordReset spr; + SerializablePasswordReset? spr; await using (var str = File.OpenRead(resetFile)) { spr = await JsonSerializer.DeserializeAsync(str).ConfigureAwait(false); } + if (spr == null) + { + throw new NullReferenceException(nameof(spr)); + } + if (spr.ExpirationDate < DateTime.UtcNow) { File.Delete(resetFile);