diff --git a/src/controller/user/controller.go b/src/controller/user/controller.go index d646a61ea..1b3576b76 100644 --- a/src/controller/user/controller.go +++ b/src/controller/user/controller.go @@ -113,7 +113,7 @@ func (c *controller) Get(ctx context.Context, id int, opt *Option) (*models.User return nil, fmt.Errorf("can't find security context") } lsc, ok := sctx.(*local.SecurityContext) - if ok && lsc.User().UserID == id { + if ok && lsc.User() != nil && lsc.User().UserID == id { u.AdminRoleInAuth = lsc.User().AdminRoleInAuth } if opt != nil && opt.WithOIDCInfo {