Fix stream decoder

This commit is contained in:
Masaaki Goshima 2021-04-30 04:06:23 +09:00
parent 16a358048e
commit 17392ab716
1 changed files with 6 additions and 0 deletions

View File

@ -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) ep := unsafe.Pointer(uintptr(data) + uintptr(idx)*d.size)
if d.isElemPointerType { if d.isElemPointerType {
*(*unsafe.Pointer)(ep) = nil // initialize elem pointer *(*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 { if err := d.valueDecoder.decodeStream(s, depth, ep); err != nil {
return err return err