Skip to content

Commit

Permalink
Always return a list from GetCommitsFromIDs (#12981)
Browse files Browse the repository at this point in the history
`GetCommitsFromIDs` is only used in one place: `LoadPushCommits` where
it expects that `c.Commits` is not nil.

This potentially nil set causes a NPE in in #12953

Fix #12953

Signed-off-by: Andrew Thornton <art27@cantab.net>
  • Loading branch information
zeripath authored Sep 29, 2020
1 parent 1bcf1ad commit fe79b13
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions modules/git/repo_commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,10 +504,6 @@ func (repo *Repository) getBranches(commit *Commit, limit int) ([]string, error)

// GetCommitsFromIDs get commits from commit IDs
func (repo *Repository) GetCommitsFromIDs(commitIDs []string) (commits *list.List) {
if len(commitIDs) == 0 {
return nil
}

commits = list.New()

for _, commitID := range commitIDs {
Expand Down

0 comments on commit fe79b13

Please sign in to comment.