Skip to content

Commit 14113b3

Browse files
cmd/internal/obj: don't crash on nil in Prog.String
I can't remember just how this happened to me, but I got an unfortunate crash with some set of cmd/compile debug options and source code. Change-Id: Ibef6129c50b68dad0594ac439466bfbc4b32a095 Reviewed-on: https://go-review.googlesource.com/19920 Run-TryBot: Ian Lance Taylor <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent d44088f commit 14113b3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/cmd/internal/obj/util.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,10 @@ func CConv(s uint8) string {
287287
}
288288

289289
func (p *Prog) String() string {
290+
if p == nil {
291+
return "<nil Prog>"
292+
}
293+
290294
if p.Ctxt == nil {
291295
return "<Prog without ctxt>"
292296
}

0 commit comments

Comments
 (0)