Skip to content

Commit

Permalink
avoid nil pointer dereference error
Browse files Browse the repository at this point in the history
  • Loading branch information
jreisinger committed Apr 19, 2022
1 parent f79d1c2 commit 2d6de24
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ func (rs Results) SortByName() {
// PrintSummary prints summary results from Info and InfoSec checks.
func (rs Results) PrintSummary() {
for _, r := range rs {
// if r.Info == nil {
// continue
// }
// To avoid "invalid memory address or nil pointer dereference"
// runtime error.
if r.Info == nil {
continue
}
if r.Type == checkip.TypeInfo || r.Type == checkip.TypeInfoSec {
fmt.Printf("%-15s --> %s\n", r.Name, r.Info.Summary())
}
Expand Down

0 comments on commit 2d6de24

Please sign in to comment.