From 09de492ec9c4d47997b9c9716e147a19335f1e4c Mon Sep 17 00:00:00 2001 From: Bill Rich Date: Fri, 15 Apr 2022 15:32:16 -0800 Subject: [PATCH] Check that required info is present (#415) --- pkg/sources/git/git.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/sources/git/git.go b/pkg/sources/git/git.go index e13335040d7b..862462b37ab9 100644 --- a/pkg/sources/git/git.go +++ b/pkg/sources/git/git.go @@ -279,6 +279,10 @@ func (s *Git) ScanCommits(repo *git.Repository, path string, scanOptions *ScanOp var depth int64 var reachedBase = false for file := range fileChan { + if file == nil || file.PatchHeader == nil { + log.Debugf("file missing patch header, skipping") + continue + } log.WithField("commit", file.PatchHeader.SHA).WithField("file", file.NewName).Trace("Scanning file from git") if scanOptions.MaxDepth > 0 && depth >= scanOptions.MaxDepth { log.Debugf("reached max depth")