From 17392ab7167e4c2eb7db12c1359a174c431070a5 Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Fri, 30 Apr 2021 04:06:23 +0900 Subject: [PATCH] Fix stream decoder --- decode_slice.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/decode_slice.go b/decode_slice.go index 603d34b..aa67ef2 100644 --- a/decode_slice.go +++ b/decode_slice.go @@ -121,6 +121,12 @@ func (d *sliceDecoder) decodeStream(s *stream, depth int64, p unsafe.Pointer) er ep := unsafe.Pointer(uintptr(data) + uintptr(idx)*d.size) if d.isElemPointerType { *(*unsafe.Pointer)(ep) = nil // initialize elem pointer + } else if d.isElemSliceType { + *(*sliceHeader)(ep) = sliceHeader{ + data: newArray(d.elemType, 0), + len: 0, + cap: 0, + } } if err := d.valueDecoder.decodeStream(s, depth, ep); err != nil { return err