diff --git a/pkg/iac/rego/load.go b/pkg/iac/rego/load.go index 4c37edb80f33..284fd2f653a2 100644 --- a/pkg/iac/rego/load.go +++ b/pkg/iac/rego/load.go @@ -149,6 +149,10 @@ func (s *Scanner) fallbackChecks(compiler *ast.Compiler) { var excludedFiles []string for _, e := range compiler.Errors { + if e.Location == nil { + continue + } + loc := e.Location.File if lo.Contains(excludedFiles, loc) {