From 5077f024d5e38cdc1634942d1fece38273cb539a Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 4 Apr 2017 02:08:07 +0200 Subject: [PATCH] common/math: encode nil HexOrDecimal256 as 0x0 --- common/math/big.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/math/big.go b/common/math/big.go index 0b67a1b503..5255a88e9f 100644 --- a/common/math/big.go +++ b/common/math/big.go @@ -51,6 +51,9 @@ func (i *HexOrDecimal256) UnmarshalText(input []byte) error { // MarshalText implements encoding.TextMarshaler. func (i *HexOrDecimal256) MarshalText() ([]byte, error) { + if i == nil { + return []byte("0x0"), nil + } return []byte(fmt.Sprintf("%#x", (*big.Int)(i))), nil }