Skip to content

Commit

Permalink
Fix segfault for nil repo (#16)
Browse files Browse the repository at this point in the history
FIXES=#15
  • Loading branch information
gaschler authored Mar 27, 2018
1 parent ef46707 commit ff5f1db
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions wally_the_cartographer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ func postCommentToPr(ctx context.Context, client *github.Client, repo *github.Re

func handleWorkItem(ctx context.Context, state *PullRequestState, client *github.Client, pullRequest *github.PullRequest, repo *github.Repository, datadir string, log io.Writer) (bool, error) {
fmt.Fprintf(log, "=> handle work item: PR %d on %s/%s.\n", pullRequest.GetNumber(), *repo.Owner.Login, *repo.Name)
if pullRequest.Head.Repo == nil {
fmt.Fprintf(log, "Warning: Ignored PR %d on %s/%s because it has no upstream repo.\n", pullRequest.GetNumber(), *repo.Owner.Login, *repo.Name)
return true, nil
}
if err := switchToAndUpdateMaster(repo, datadir, log); err != nil {
return true, err
}
Expand Down Expand Up @@ -424,6 +428,10 @@ func handleRepo(ctx context.Context, client *github.Client, userName string, tea

for _, pullRequest := range pullRequests {
log.Printf("=> handle pull request: PR %d on %s/%s.\n", pullRequest.GetNumber(), *repo.Owner.Login, *repo.Name)
if pullRequest.Head.Repo == nil {
log.Printf("Warning: Ignored PR %d on %s/%s because it has no upstream repo.\n", pullRequest.GetNumber(), *repo.Owner.Login, *repo.Name)
continue
}
prNum := pullRequest.GetNumber()
prState := repositoryState.PullRequests[prNum]
if prState == nil {
Expand Down

0 comments on commit ff5f1db

Please sign in to comment.