diff options
author | zeripath <art27@cantab.net> | 2020-09-29 22:26:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-29 22:26:54 +0100 |
commit | fe79b13ab2ce9526fae10a5257b4e171cae30ecb (patch) | |
tree | 1b846b92b99e07423f744a683440de8843832d47 /modules/git | |
parent | 1bcf1ad6434e45c28b9232032284299334663026 (diff) | |
download | gitea-fe79b13ab2ce9526fae10a5257b4e171cae30ecb.tar.gz gitea-fe79b13ab2ce9526fae10a5257b4e171cae30ecb.zip |
Always return a list from GetCommitsFromIDs (#12981)
`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>
Diffstat (limited to 'modules/git')
-rw-r--r-- | modules/git/repo_commit.go | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go index 45745c8088..c9a5efb24e 100644 --- a/modules/git/repo_commit.go +++ b/modules/git/repo_commit.go @@ -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 { |