1
0
mirror of https://github.com/golang/go synced 2024-11-19 11:04:47 -07:00

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/20595
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Michael Munday 2016-03-11 10:21:51 -05:00 committed by Brad Fitzpatrick
parent f973e79d09
commit d05773ce73

View File

@ -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)
}