Fix tests with nil check via reflection

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-08-18 12:14:47 +03:00 committed by Stanislav Bogatyrev
parent 1592151621
commit c3604d00f0

View file

@ -9,6 +9,7 @@ package proto
import (
"encoding/binary"
"math/bits"
"reflect"
)
type (
@ -305,7 +306,7 @@ func NestedStructurePrefix(field int64) (prefix uint64, ln int) {
}
func NestedStructureMarshal(field int64, buf []byte, v stableMarshaller) (int, error) {
if v == nil {
if v == nil || reflect.ValueOf(v).IsNil() {
return 0, nil
}
@ -324,7 +325,7 @@ func NestedStructureMarshal(field int64, buf []byte, v stableMarshaller) (int, e
}
func NestedStructureSize(field int64, v stableMarshaller) (size int) {
if v == nil {
if v == nil || reflect.ValueOf(v).IsNil() {
return 0
}