Fix nil ptr dereference (#907)

Co-authored-by: Azeem Shaikh <azeems@google.com>
Co-authored-by: Naveen <172697+naveensrinivasan@users.noreply.github.com>
This commit is contained in:
Azeem Shaikh 2021-08-25 07:09:24 -07:00 committed by GitHub
parent cc30d54db2
commit e73f08e76c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,13 +86,15 @@ func (handler *tarballHandler) init(ctx context.Context, repo *github.Repository
}
// Extract file names and content from tarball.
err := handler.extractTarball()
if errors.Is(err, errTarballCorrupted) {
if err := handler.extractTarball(); errors.Is(err, errTarballCorrupted) {
log.Printf("unable to extract tarball %v. Skipping...", err)
return nil
} else if err != nil {
// nolint: wrapcheck
return sce.Create(sce.ErrScorecardInternal, err.Error())
}
// nolint: wrapcheck
return sce.Create(sce.ErrScorecardInternal, err.Error())
return nil
}
func (handler *tarballHandler) getTarball(ctx context.Context, repo *github.Repository) error {