aboutsummaryrefslogtreecommitdiffstats
path: root/rlp/encode.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-03-18 06:49:49 +0800
committerFelix Lange <fjl@twurst.com>2015-03-18 06:49:49 +0800
commitcb009a5c4da40e1987b9dfcffa4d52bcae41e4e1 (patch)
treecc09681b0e4ba1391dfcd27c34f941fc304dedcb /rlp/encode.go
parent86661de07746cd4e4ad8d016afee9fa8074aa141 (diff)
downloaddexon-cb009a5c4da40e1987b9dfcffa4d52bcae41e4e1.tar
dexon-cb009a5c4da40e1987b9dfcffa4d52bcae41e4e1.tar.gz
dexon-cb009a5c4da40e1987b9dfcffa4d52bcae41e4e1.tar.bz2
dexon-cb009a5c4da40e1987b9dfcffa4d52bcae41e4e1.tar.lz
dexon-cb009a5c4da40e1987b9dfcffa4d52bcae41e4e1.tar.xz
dexon-cb009a5c4da40e1987b9dfcffa4d52bcae41e4e1.tar.zst
dexon-cb009a5c4da40e1987b9dfcffa4d52bcae41e4e1.zip
rlp: don't panic for nil *big.Int
All other pointer types can handle nil just fine.
Diffstat (limited to 'rlp/encode.go')
-rw-r--r--rlp/encode.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/rlp/encode.go b/rlp/encode.go
index 9d11d66bf..42bbb876c 100644
--- a/rlp/encode.go
+++ b/rlp/encode.go
@@ -386,7 +386,12 @@ func writeUint(val reflect.Value, w *encbuf) error {
}
func writeBigIntPtr(val reflect.Value, w *encbuf) error {
- return writeBigInt(val.Interface().(*big.Int), w)
+ ptr := val.Interface().(*big.Int)
+ if ptr == nil {
+ w.str = append(w.str, 0x80)
+ return nil
+ }
+ return writeBigInt(ptr, w)
}
func writeBigIntNoPtr(val reflect.Value, w *encbuf) error {