fix: 修复currenuser为空问题

This commit is contained in:
陈淳
2023-02-27 08:52:45 +08:00
parent 6bf490f7da
commit 33616de6c8
6 changed files with 2 additions and 37 deletions

View File

@@ -62,7 +62,7 @@ namespace Yi.Framework.Core.CurrentUsers
public long FindUserId()
{
var userIdOrNull = _principalAccessor.Principal.Claims?.FirstOrDefault(c => c.Type == TokenTypeConst.Id);
var userIdOrNull = _principalAccessor.Principal?.Claims?.FirstOrDefault(c => c.Type == TokenTypeConst.Id);
if (userIdOrNull == null || string.IsNullOrWhiteSpace(userIdOrNull.Value))
{
return 0;