Skip to content

Commit

Permalink
Prevent NPE on empty commit (go-gitea#16812)
Browse files Browse the repository at this point in the history
Backport go-gitea#16812

Handle completely empty commit as the first commit to a repository.

Fix go-gitea#16668

Signed-off-by: Andrew Thornton art27@cantab.net
  • Loading branch information
zeripath committed Aug 25, 2021
1 parent 63178b5 commit ce4d290
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/git/log_name_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ func (g *LogNameStatusRepoParser) Next(treepath string, paths2ids map[string]int
return nil, err
}
}
if len(g.next) == 0 {
return &ret, nil
}
if g.next[0] == '\x00' {
g.buffull = false
g.next, err = g.rd.ReadSlice('\x00')
Expand Down

0 comments on commit ce4d290

Please sign in to comment.