Fix possible NullReferenceException

This commit is contained in:
Patrick Barron 2020-10-29 19:16:39 -04:00
parent e0045457f9
commit d887e42405

View file

@ -460,7 +460,7 @@ namespace Jellyfin.Server.Implementations.Users
// the authentication provider might have created it
user = Users.FirstOrDefault(i => string.Equals(username, i.Username, StringComparison.OrdinalIgnoreCase));
if (authenticationProvider is IHasNewUserPolicy hasNewUserPolicy)
if (authenticationProvider is IHasNewUserPolicy hasNewUserPolicy && user != null)
{
UpdatePolicy(user.Id, hasNewUserPolicy.GetNewUserPolicy());