Skip to content

Commit 2e93d45

Browse files
committed
fix: panic with nil Referrers
1 parent 544cac6 commit 2e93d45

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/analyzer/defer_only.go

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

295-
if len(*instr.Addr.Referrers()) == 0 {
295+
if instr.Addr.Referrers() == nil || len(*instr.Addr.Referrers()) == 0 {
296296
return actionNoOp
297297
}
298298

@@ -378,7 +378,7 @@ func checkDeferred(pass *analysis.Pass, instrs *[]ssa.Instruction, targetTypes [
378378
return
379379
}
380380
case *ssa.Store:
381-
if len(*instr.Addr.Referrers()) == 0 {
381+
if instr.Addr.Referrers() == nil || len(*instr.Addr.Referrers()) == 0 {
382382
return
383383
}
384384

0 commit comments

Comments
 (0)