Skip to content

Commit ca0cc27

Browse files
committed
fix: Panic on nil Call.Method
Fix a panic caused by using a nil Call.Method. Fixes golangci/golangci-lint#733
1 parent 42cacc3 commit ca0cc27

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

passes/bodyclose/bodyclose.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ func (r *runner) calledInFunc(f *ssa.Function, called bool) bool {
325325
}
326326
for _, vref := range vrefs {
327327
if c, ok := vref.(*ssa.Call); ok {
328-
if c.Call.Method.Name() == closeMethod {
328+
if c.Call.Method != nil && c.Call.Method.Name() == closeMethod {
329329
return !called
330330
}
331331
}

0 commit comments

Comments
 (0)