mirror of
https://github.com/golang/go
synced 2024-11-20 00:04:43 -07:00
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
This commit is contained in:
parent
23f6479be6
commit
8fc6703391
@ -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, "<nil>")
|
||||
return
|
||||
}
|
||||
if x.neg {
|
||||
fmt.Fprint(s, "-")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user