From 879e65b5c5d7ea3d64a040fdc67481a11e976979 Mon Sep 17 00:00:00 2001 From: Dustin Decker Date: Sat, 16 Apr 2022 15:41:51 -0700 Subject: [PATCH] Handle nil file channel (#417) --- 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 862462b3..54648aee 100644 --- a/pkg/sources/git/git.go +++ b/pkg/sources/git/git.go @@ -272,6 +272,10 @@ func (s *Git) ScanCommits(repo *git.Repository, path string, scanOptions *ScanOp if err != nil { return errors.WrapPrefix(err, "could not open repo path", 0) } + // parser can return nil chan and nil error + if fileChan == nil { + return errors.New("nothing to scan") + } // get the URL metadata for reporting (may be empty) urlMetadata := getSafeRemoteURL(repo, "origin")