]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj: don't crash on nil in Prog.String
authorIan Lance Taylor <iant@golang.org>
Thu, 25 Feb 2016 18:44:31 +0000 (10:44 -0800)
committerIan Lance Taylor <iant@golang.org>
Thu, 25 Feb 2016 19:13:11 +0000 (19:13 +0000)
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: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/internal/obj/util.go

index 12b048d8e14efa1d19fba1f17f897466f73e7c30..8ecf800502201c4a3236226329ee29ecc6e1ed0e 100644 (file)
@@ -287,6 +287,10 @@ func CConv(s uint8) string {
 }
 
 func (p *Prog) String() string {
+       if p == nil {
+               return "<nil Prog>"
+       }
+
        if p.Ctxt == nil {
                return "<Prog without ctxt>"
        }