From 0611b5cc6700a74a624230b50b608b376d416fdb Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Tue, 11 Feb 2020 15:45:39 +0100 Subject: [PATCH] github: handle nil user email --- internal/gitsources/github/github.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/internal/gitsources/github/github.go b/internal/gitsources/github/github.go index 51a83b0..fbd0a63 100644 --- a/internal/gitsources/github/github.go +++ b/internal/gitsources/github/github.go @@ -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) {