Skip to content

Commit 543e79f

Browse files
committed
fix: avoid nil pointer dereference in wrapmsg.go
1 parent add7445 commit 543e79f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

wrapmsg.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var Analyzer = &analysis.Analyzer{
1919
}
2020

2121
func isErrorf(call *ssa.Call) bool {
22-
if f, ok := ssautil.Operands(call)[0].(*ssa.Function); ok && f.Pkg.Pkg.Path() == "testing" {
22+
if f, _ := ssautil.Operands(call)[0].(*ssa.Function); f != nil && f.Pkg != nil && f.Pkg.Pkg != nil && f.Pkg.Pkg.Path() == "testing" {
2323
// avoid targeting (*testing.T).Errorf
2424
return false
2525
}

0 commit comments

Comments
 (0)