Skip to content

Commit 084f423

Browse files
authored
fix: Referrers() may return nil (#46)
1 parent 3ec3977 commit 084f423

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/analyzer/defer_only.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,10 @@ func getAction(instr ssa.Instruction, targetTypes []any) action {
292292
return actionReturned
293293
}
294294

295+
if instr.Addr.Referrers() == nil {
296+
return actionNoOp
297+
}
298+
295299
if len(*instr.Addr.Referrers()) == 0 {
296300
return actionNoOp
297301
}
@@ -378,6 +382,10 @@ func checkDeferred(pass *analysis.Pass, instrs *[]ssa.Instruction, targetTypes [
378382
return
379383
}
380384
case *ssa.Store:
385+
if instr.Addr.Referrers() == nil {
386+
return
387+
}
388+
381389
if len(*instr.Addr.Referrers()) == 0 {
382390
return
383391
}

0 commit comments

Comments
 (0)