aboutsummaryrefslogtreecommitdiffstats
path: root/rlp/decode.go
diff options
context:
space:
mode:
Diffstat (limited to 'rlp/decode.go')
-rw-r--r--rlp/decode.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/rlp/decode.go b/rlp/decode.go
index 6d7e670c2..0e99d9caa 100644
--- a/rlp/decode.go
+++ b/rlp/decode.go
@@ -367,7 +367,12 @@ func makePtrDecoder(typ reflect.Type) (decoder, error) {
dec := func(s *Stream, val reflect.Value) (err error) {
_, size, err := s.Kind()
if err != nil || size == 0 && s.byteval == 0 {
- val.Set(reflect.Zero(typ)) // set to nil
+ // rearm s.Kind. This is important because the input
+ // position must advance to the next value even though
+ // we don't read anything.
+ s.kind = -1
+ // set the pointer to nil.
+ val.Set(reflect.Zero(typ))
return err
}
newval := val