From d97837dab65762c7d3c767d77c3d101b2f7e9bbd Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 16 Jul 2024 20:27:30 +0800 Subject: [PATCH] :bug: Use get function to prevent null pointer exception --- pkg/internal/server/exts/auth.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/internal/server/exts/auth.go b/pkg/internal/server/exts/auth.go index 3437550..3e1fc20 100644 --- a/pkg/internal/server/exts/auth.go +++ b/pkg/internal/server/exts/auth.go @@ -123,12 +123,12 @@ func LinkAccountMiddleware(c *fiber.Ctx) error { if val, ok := c.Locals("p_user").(*proto.UserInfo); ok { account := models.Account{ BaseModel: models.BaseModel{ - ID: uint(val.Id), + ID: uint(val.GetId()), }, - Name: val.Name, - Nick: val.Nick, - Avatar: val.Avatar, - Banner: val.Banner, + Name: val.GetName(), + Nick: val.GetNick(), + Avatar: val.GetAvatar(), + Banner: val.GetBanner(), Description: val.GetDescription(), EmailAddress: val.GetEmail(), }