Skip to content

Commit

Permalink
Avoid panic with scorecard logs.
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Mendoza <[email protected]>
  • Loading branch information
jeffmendoza committed Mar 1, 2024
1 parent c532eed commit fd16908
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/policies/scorecard/scorecard.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func convertLogs(logs []checker.CheckDetail) []string {
var s []string
for _, l := range logs {
if l.Msg.Finding != nil {
if l.Msg.Finding.Location == nil {
if l.Msg.Finding.Location == nil || l.Msg.Finding.Location.Snippet == nil || l.Msg.Finding.Location.LineStart == nil {
s = append(s, fmt.Sprintf("%v", l.Msg.Finding.Message))
} else {
s = append(s, fmt.Sprintf("%v[%v]:%v", *l.Msg.Finding.Location.Snippet, *l.Msg.Finding.Location.LineStart, l.Msg.Finding.Message))
Expand Down

0 comments on commit fd16908

Please sign in to comment.