- nil compare

This commit is contained in:
gazebo
2019-03-04 18:10:19 +08:00
parent 97b23b2a09
commit 4e13b0a42d
2 changed files with 5 additions and 4 deletions

View File

@@ -30,7 +30,10 @@ type UserProvider struct {
func (*UserProvider) GetUser(authID, authIDType string) (user auth2.IUser) {
fieldName := authTypeFieldMap[authIDType]
if fieldName != "" {
user, _ = dao.GetUserByID(dao.GetDB(), fieldName, authID)
user2, err := dao.GetUserByID(dao.GetDB(), fieldName, authID)
if err == nil {
user = user2 // 这样写的原因是golang nil的比较问题
}
}
return user
}