Browse Source

feat:增加nil判断处理

zhangxinlei1996 3 năm trước cách đây
mục cha
commit
08674ba819
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      api/internal/logic/getuserinfologic.go

+ 2 - 1
api/internal/logic/getuserinfologic.go

@@ -45,10 +45,11 @@ func (l *GetUserInfoLogic) GetUserInfo(req *types.UserReq) (resp *types.Resp, er
 		UserId: int64(userId),
 		Types:  req.Types,
 	})
-	if err != nil {
+	if err != nil || res == nil {
 		resp.Error_msg = ""
 		resp.Error_code = -1
 		l.Error("get user info error:", err)
+		return
 	}
 	if res.ErrorMsg != "" {
 		resp.Error_msg = res.ErrorMsg