Add comment on binary/reflect and nil-dogs
This commit is contained in:
parent
c30d38270c
commit
6dafd68873
|
@ -447,6 +447,9 @@ func writeReflectBinary(rv reflect.Value, rt reflect.Type, opts Options, w io.Wr
|
||||||
rv, rt = rv.Elem(), rt.Elem()
|
rv, rt = rv.Elem(), rt.Elem()
|
||||||
typeInfo = GetTypeInfo(rt)
|
typeInfo = GetTypeInfo(rt)
|
||||||
if !rv.IsValid() {
|
if !rv.IsValid() {
|
||||||
|
// For better compatibility with other languages,
|
||||||
|
// as far as tendermint/binary is concerned,
|
||||||
|
// pointers to nil values are the same as nil.
|
||||||
WriteByte(0x00, w, n, err)
|
WriteByte(0x00, w, n, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -845,6 +848,9 @@ func writeReflectJSON(rv reflect.Value, rt reflect.Type, w io.Writer, n *int64,
|
||||||
rv, rt = rv.Elem(), rt.Elem()
|
rv, rt = rv.Elem(), rt.Elem()
|
||||||
typeInfo = GetTypeInfo(rt)
|
typeInfo = GetTypeInfo(rt)
|
||||||
if !rv.IsValid() {
|
if !rv.IsValid() {
|
||||||
|
// For better compatibility with other languages,
|
||||||
|
// as far as tendermint/binary is concerned,
|
||||||
|
// pointers to nil values are the same as nil.
|
||||||
WriteTo([]byte("null"), w, n, err)
|
WriteTo([]byte("null"), w, n, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue