From ef4abd8874d90371718861b416e91905f6eabc34 Mon Sep 17 00:00:00 2001 From: Eitan Joffe Date: Wed, 12 Apr 2023 14:33:33 -0700 Subject: [PATCH] Fix null ptr dereference in github user name fixes #302 commit-id:56249a32 --- github/githubclient/client.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/github/githubclient/client.go b/github/githubclient/client.go index 8c87bd0..f81bf15 100644 --- a/github/githubclient/client.go +++ b/github/githubclient/client.go @@ -4,7 +4,6 @@ import ( "bytes" "context" "fmt" - "gopkg.in/yaml.v3" "net/url" "os" "path" @@ -12,6 +11,8 @@ import ( "regexp" "strings" + "gopkg.in/yaml.v3" + "github.com/ejoffe/spr/config" "github.com/ejoffe/spr/git" "github.com/ejoffe/spr/github" @@ -264,11 +265,14 @@ func (c *client) GetAssignableUsers(ctx context.Context) []github.RepoAssignee { } for _, node := range *resp.Repository.AssignableUsers.Nodes { - users = append(users, github.RepoAssignee{ + user := github.RepoAssignee{ ID: node.Id, Login: node.Login, - Name: *node.Name, - }) + } + if node.Name != nil { + user.Name = *node.Name + } + users = append(users, user) } if !resp.Repository.AssignableUsers.PageInfo.HasNextPage { break