Commit 14113b3a authored by Ian Lance Taylor's avatar Ian Lance Taylor

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 <iant@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent d44088f1
...@@ -287,6 +287,10 @@ func CConv(s uint8) string { ...@@ -287,6 +287,10 @@ func CConv(s uint8) string {
} }
func (p *Prog) String() string { func (p *Prog) String() string {
if p == nil {
return "<nil Prog>"
}
if p.Ctxt == nil { if p.Ctxt == nil {
return "<Prog without ctxt>" return "<Prog without ctxt>"
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment