github: handle nil user email

This commit is contained in:
Simone Gotti 2020-02-11 15:45:39 +01:00
parent 996e2a54ab
commit 0611b5cc67
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 { if err != nil {
return nil, err return nil, err
} }
return &gitsource.UserInfo{
userInfo := &gitsource.UserInfo{
ID: strconv.FormatInt(*user.ID, 10), ID: strconv.FormatInt(*user.ID, 10),
LoginName: *user.Login, 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) { func (c *Client) GetRepoInfo(repopath string) (*gitsource.RepoInfo, error) {