mirror of
https://github.com/json-iterator/go.git
synced 2025-06-09 22:37:36 +02:00
fix encoding of nil non-empty interface
This commit is contained in:
parent
2f7e5c8dd7
commit
ddc5af4512
@ -397,9 +397,11 @@ func (codec *nonEmptyInterfaceCodec) Decode(ptr unsafe.Pointer, iter *Iterator)
|
|||||||
func (codec *nonEmptyInterfaceCodec) Encode(ptr unsafe.Pointer, stream *Stream) {
|
func (codec *nonEmptyInterfaceCodec) Encode(ptr unsafe.Pointer, stream *Stream) {
|
||||||
nonEmptyInterface := (*nonEmptyInterface)(ptr)
|
nonEmptyInterface := (*nonEmptyInterface)(ptr)
|
||||||
var i interface{}
|
var i interface{}
|
||||||
e := (*emptyInterface)(unsafe.Pointer(&i))
|
if nonEmptyInterface.itab != nil {
|
||||||
e.typ = nonEmptyInterface.itab.typ
|
e := (*emptyInterface)(unsafe.Pointer(&i))
|
||||||
e.word = nonEmptyInterface.word
|
e.typ = nonEmptyInterface.itab.typ
|
||||||
|
e.word = nonEmptyInterface.word
|
||||||
|
}
|
||||||
stream.WriteVal(i)
|
stream.WriteVal(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user