1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-04 17:47:19 +00:00

Fix potential bugs (#10513)

* use e if it is an option
* potential nil so check err first
* check err first
* m == nil already checked
This commit is contained in:
6543
2020-02-28 00:10:27 +01:00
committed by GitHub
parent 15fbf509d3
commit e57ac841de
7 changed files with 14 additions and 10 deletions

View File

@ -244,11 +244,11 @@ func Diff(ctx *context.Context) {
parents := make([]string, commit.ParentCount())
for i := 0; i < commit.ParentCount(); i++ {
sha, err := commit.ParentID(i)
parents[i] = sha.String()
if err != nil {
ctx.NotFound("repo.Diff", err)
return
}
parents[i] = sha.String()
}
ctx.Data["CommitID"] = commitID