From: Adam Langley Date: Fri, 8 Apr 2011 19:43:19 +0000 (-0400) Subject: big: don't crash when printing nil ints X-Git-Tag: weekly.2011-04-13~48 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8fc67033914902065b6150fc6f0808b00dbe05b5;p=gostls13.git big: don't crash when printing nil ints "%#v" of a structure with *big.Int's tends to crash a lot otherwise. R=golang-dev, gri CC=golang-dev https://golang.org/cl/4382044 --- diff --git a/src/pkg/big/int.go b/src/pkg/big/int.go index ecd70e03ef..f1ea7b1c2e 100755 --- a/src/pkg/big/int.go +++ b/src/pkg/big/int.go @@ -337,6 +337,10 @@ func fmtbase(ch int) int { // 'x' (hexadecimal). // func (x *Int) Format(s fmt.State, ch int) { + if x == nil { + fmt.Fprint(s, "") + return + } if x.neg { fmt.Fprint(s, "-") }