Assign nil at null value

This commit is contained in:
Masaaki Goshima 2020-12-23 01:29:13 +09:00
parent b4a3ab8203
commit 1dee747400
1 changed files with 2 additions and 0 deletions

View File

@ -40,6 +40,7 @@ func (d *ptrDecoder) decodeStream(s *stream, p unsafe.Pointer) error {
if err := nullBytes(s); err != nil { if err := nullBytes(s); err != nil {
return err return err
} }
*(*unsafe.Pointer)(p) = nil
return nil return nil
} }
newptr := unsafe_New(d.typ) newptr := unsafe_New(d.typ)
@ -66,6 +67,7 @@ func (d *ptrDecoder) decode(buf []byte, cursor int64, p unsafe.Pointer) (int64,
if buf[cursor+3] != 'l' { if buf[cursor+3] != 'l' {
return 0, errInvalidCharacter(buf[cursor+3], "null", cursor) return 0, errInvalidCharacter(buf[cursor+3], "null", cursor)
} }
*(*unsafe.Pointer)(p) = nil
cursor += 4 cursor += 4
return cursor, nil return cursor, nil
} }