From e891d68dd71d9f61aa51a8fbf1e5d4fd3b9d76be Mon Sep 17 00:00:00 2001 From: zeripath Date: Wed, 25 Aug 2021 00:33:23 +0100 Subject: [PATCH] Prevent NPE on empty commit (#16812) --- modules/git/log_name_status.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/git/log_name_status.go b/modules/git/log_name_status.go index 803d614d61..00a1859f7a 100644 --- a/modules/git/log_name_status.go +++ b/modules/git/log_name_status.go @@ -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')