forked from mirror/go-json
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 {
|
||||
return err
|
||||
}
|
||||
*(*unsafe.Pointer)(p) = nil
|
||||
return nil
|
||||
}
|
||||
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' {
|
||||
return 0, errInvalidCharacter(buf[cursor+3], "null", cursor)
|
||||
}
|
||||
*(*unsafe.Pointer)(p) = nil
|
||||
cursor += 4
|
||||
return cursor, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue