forked from mirror/go-json
Fix encoding of nil value for opMarshalText
This commit is contained in:
parent
24aa07e47f
commit
7e55f41a59
|
@ -486,10 +486,7 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
|
|||
ptr := load(ctxptr, code.idx)
|
||||
isPtr := code.typ.Kind() == reflect.Ptr
|
||||
p := e.ptrToUnsafePtr(ptr)
|
||||
if p == nil {
|
||||
b = encodeNull(b)
|
||||
b = encodeComma(b)
|
||||
} else if isPtr && *(*unsafe.Pointer)(p) == nil {
|
||||
if p == nil || isPtr && *(*unsafe.Pointer)(p) == nil {
|
||||
b = append(b, '"', '"', ',')
|
||||
} else {
|
||||
v := *(*interface{})(unsafe.Pointer(&interfaceHeader{
|
||||
|
|
Loading…
Reference in New Issue