Commit d05773ce authored by Michael Munday's avatar Michael Munday Committed by Brad Fitzpatrick

cmd/internal/obj: fix nil pointer dereference in Dconv

p can be nil in Dconv so we need to do a check before dereferencing
it. Fixes a problem I was having running toolstash.

Change-Id: I34d6d278b319583d8454c2342ac88e054fc4b641
Reviewed-on: https://go-review.googlesource.com/20595Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent f973e79d
......@@ -406,7 +406,7 @@ func Dconv(p *Prog, a *Addr) string {
if a.Index != REG_NONE {
str += fmt.Sprintf("(%v*%d)", Rconv(int(a.Index)), int(a.Scale))
}
if p.As == ATYPE && a.Gotype != nil {
if p != nil && p.As == ATYPE && a.Gotype != nil {
str += fmt.Sprintf("%s", a.Gotype.Name)
}
......
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