From 93b73ef69e74c205d7c52382288d9eb2afdf4c2d Mon Sep 17 00:00:00 2001 From: Cam Date: Wed, 19 Jun 2024 02:00:34 +0200 Subject: [PATCH] fix: check validity of id.Obj pointer before dereference (#22) --- spancheck.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spancheck.go b/spancheck.go index d5d35a5..8fc7945 100644 --- a/spancheck.go +++ b/spancheck.go @@ -389,7 +389,7 @@ func usesCall( // Selector (End, SetStatus, RecordError) hit. if n.Sel.Name == selName { id, ok := n.X.(*ast.Ident) - found = ok && id.Obj.Decl == sv.id.Obj.Decl + found = ok && id.Obj != nil && id.Obj.Decl == sv.id.Obj.Decl } // Check if an ignore signature matches.