mirror of https://github.com/goccy/go-json.git
Assign nil at null value
This commit is contained in:
parent
b4a3ab8203
commit
1dee747400
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue