Skip to content

Find, verify, and analyze leaked credentials

Fix gitparse from panicking on a nil-pointer (#1570)

Miccah6bd48583ae96
diff --git a/pkg/gitparse/gitparse.go b/pkg/gitparse/gitparse.go
index 84a9da26e..8e8925111 100644
--- a/pkg/gitparse/gitparse.go
+++ b/pkg/gitparse/gitparse.go
@@ -420,7 +420,7 @@ func (c *Parser) FromReader(ctx context.Context, stdOut io.Reader, commitChan ch
latestState = ParseFailure
}
- if currentDiff.Content.Len() > c.maxDiffSize {
+ if currentDiff != nil && currentDiff.Content.Len() > c.maxDiffSize {
ctx.Logger().V(2).Info(fmt.Sprintf(
"Diff for %s exceeded MaxDiffSize(%d)", currentDiff.PathB, c.maxDiffSize,
))