Merge pull request #207 from sgotti/github_handle_empty_user_email

github: handle nil user email
This commit is contained in:
Simone Gotti 2020-02-11 17:53:29 +01:00 committed by GitHub
commit 6c9105ddd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -197,11 +197,16 @@ func (c *Client) GetUserInfo() (*gitsource.UserInfo, error) {
if err != nil {
return nil, err
}
return &gitsource.UserInfo{
userInfo := &gitsource.UserInfo{
ID: strconv.FormatInt(*user.ID, 10),
LoginName: *user.Login,
Email: *user.Email,
}, nil
}
if user.Email != nil {
userInfo.Email = *user.Email
}
return userInfo, nil
}
func (c *Client) GetRepoInfo(repopath string) (*gitsource.RepoInfo, error) {