mirror of
https://github.com/golang/go
synced 2024-11-20 06:44:40 -07:00
Prevent Printf crashing when giving an extra nil argument.
R=rsc, r CC=golang-dev https://golang.org/cl/1195041
This commit is contained in:
parent
e0bde8cfe8
commit
14e04f4d40
@ -1053,8 +1053,10 @@ func (p *pp) doprintf(format string, a []interface{}) {
|
|||||||
p.buf.Write(extraBytes)
|
p.buf.Write(extraBytes)
|
||||||
for ; fieldnum < len(a); fieldnum++ {
|
for ; fieldnum < len(a); fieldnum++ {
|
||||||
field := a[fieldnum]
|
field := a[fieldnum]
|
||||||
|
if field != nil {
|
||||||
p.buf.WriteString(reflect.Typeof(field).String())
|
p.buf.WriteString(reflect.Typeof(field).String())
|
||||||
p.buf.WriteByte('=')
|
p.buf.WriteByte('=')
|
||||||
|
}
|
||||||
p.printField(field, false, false, 0)
|
p.printField(field, false, false, 0)
|
||||||
if fieldnum+1 < len(a) {
|
if fieldnum+1 < len(a) {
|
||||||
p.buf.Write(commaSpaceBytes)
|
p.buf.Write(commaSpaceBytes)
|
||||||
|
Loading…
Reference in New Issue
Block a user