Skip to content

Commit ce4d290

Browse files
committed
Prevent NPE on empty commit (go-gitea#16812)
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
1 parent 63178b5 commit ce4d290

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

modules/git/log_name_status.go

+3
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ func (g *LogNameStatusRepoParser) Next(treepath string, paths2ids map[string]int
167167
return nil, err
168168
}
169169
}
170+
if len(g.next) == 0 {
171+
return &ret, nil
172+
}
170173
if g.next[0] == '\x00' {
171174
g.buffull = false
172175
g.next, err = g.rd.ReadSlice('\x00')

0 commit comments

Comments
 (0)