From 8fc67033914902065b6150fc6f0808b00dbe05b5 Mon Sep 17 00:00:00 2001 From: Adam Langley Date: Fri, 8 Apr 2011 15:43:19 -0400 Subject: [PATCH] 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 --- src/pkg/big/int.go | 4 ++++ 1 file changed, 4 insertions(+) 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, "-") } -- 2.48.1