From: Ian Lance Taylor Date: Thu, 25 Feb 2016 18:44:31 +0000 (-0800) Subject: cmd/internal/obj: don't crash on nil in Prog.String X-Git-Tag: go1.7beta1~1721 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=14113b3a89624ee6d97a7847b68361158ad43822;p=gostls13.git 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 --- 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 "" }