Commit 8fc67033 authored by Adam Langley's avatar Adam Langley

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
parent 23f6479b
...@@ -337,6 +337,10 @@ func fmtbase(ch int) int { ...@@ -337,6 +337,10 @@ func fmtbase(ch int) int {
// 'x' (hexadecimal). // 'x' (hexadecimal).
// //
func (x *Int) Format(s fmt.State, ch int) { func (x *Int) Format(s fmt.State, ch int) {
if x == nil {
fmt.Fprint(s, "<nil>")
return
}
if x.neg { if x.neg {
fmt.Fprint(s, "-") fmt.Fprint(s, "-")
} }
......
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