From 14113b3a89624ee6d97a7847b68361158ad43822 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 25 Feb 2016 10:44:31 -0800 Subject: [PATCH] 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 Reviewed-by: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- src/cmd/internal/obj/util.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cmd/internal/obj/util.go b/src/cmd/internal/obj/util.go index 12b048d8e1..8ecf800502 100644 --- a/src/cmd/internal/obj/util.go +++ b/src/cmd/internal/obj/util.go @@ -287,6 +287,10 @@ func CConv(s uint8) string { } func (p *Prog) String() string { + if p == nil { + return "" + } + if p.Ctxt == nil { return "" }