Commit 14e04f4d authored by Roger Peppe's avatar Roger Peppe Committed by Rob Pike

Prevent Printf crashing when giving an extra nil argument.

R=rsc, r
CC=golang-dev
https://golang.org/cl/1195041
parent e0bde8cf
......@@ -1053,8 +1053,10 @@ func (p *pp) doprintf(format string, a []interface{}) {
p.buf.Write(extraBytes)
for ; fieldnum < len(a); fieldnum++ {
field := a[fieldnum]
p.buf.WriteString(reflect.Typeof(field).String())
p.buf.WriteByte('=')
if field != nil {
p.buf.WriteString(reflect.Typeof(field).String())
p.buf.WriteByte('=')
}
p.printField(field, false, false, 0)
if fieldnum+1 < len(a) {
p.buf.Write(commaSpaceBytes)
......
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