From ff1f4d641aa83f145d86c5c8bf59844b302202bf Mon Sep 17 00:00:00 2001 From: Coko <91132775+Coko7@users.noreply.github.com> Date: Fri, 9 Jan 2026 14:24:55 +0100 Subject: [PATCH] fix(ClaimsIdentityFactory): default to empty list to prevent NRE closes #59 --- src/Microsoft.AspNet.Identity.Core/ClaimsIdentityFactory.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNet.Identity.Core/ClaimsIdentityFactory.cs b/src/Microsoft.AspNet.Identity.Core/ClaimsIdentityFactory.cs index da2f755..a53b817 100644 --- a/src/Microsoft.AspNet.Identity.Core/ClaimsIdentityFactory.cs +++ b/src/Microsoft.AspNet.Identity.Core/ClaimsIdentityFactory.cs @@ -101,7 +101,7 @@ public virtual async Task CreateAsync(UserManager m } if (manager.SupportsUserRole) { - IList roles = await manager.GetRolesAsync(user.Id).WithCurrentCulture(); + IList roles = await manager.GetRolesAsync(user.Id).WithCurrentCulture() ?? []; foreach (string roleName in roles) { id.AddClaim(new Claim(RoleClaimType, roleName, ClaimValueTypes.String)); @@ -128,4 +128,4 @@ public virtual string ConvertIdToString(TKey key) return key.ToString(); } } -} \ No newline at end of file +}