]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: avoid nil pointer deref in debugging output
authorRobert Griesemer <gri@golang.org>
Tue, 5 Jun 2018 23:29:06 +0000 (16:29 -0700)
committerRobert Griesemer <gri@golang.org>
Tue, 5 Jun 2018 23:43:08 +0000 (23:43 +0000)
Found while tracking down another issue.

Change-Id: If06eee72ce3e3f45dc00b3b68670e1e4d99c87a7
Reviewed-on: https://go-review.googlesource.com/116455
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/compile/internal/gc/fmt.go

index 598930bf15de714b204dec70895c55a79580cb7e..75194ca6f034de7ccfad7017b8e67223d51ab9b5 100644 (file)
@@ -1599,7 +1599,7 @@ func (n *Node) nodedump(s fmt.State, flag FmtFlag, mode fmtMode) {
 
        case OTYPE:
                mode.Fprintf(s, "%v %v%j type=%v", n.Op, n.Sym, n, n.Type)
-               if recur && n.Type == nil && n.Name.Param.Ntype != nil {
+               if recur && n.Type == nil && n.Name != nil && n.Name.Param != nil && n.Name.Param.Ntype != nil {
                        indent(s)
                        mode.Fprintf(s, "%v-ntype%v", n.Op, n.Name.Param.Ntype)
                }