Browse Source

fix handling of nil empty interface

Jason Toffaletti 8 năm trước cách đây
mục cha
commit
005d86dc44
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      feature_reflect_native.go

+ 2 - 1
feature_reflect_native.go

@@ -373,7 +373,8 @@ func (codec *emptyInterfaceCodec) EncodeInterface(val interface{}, stream *Strea
 }
 
 func (codec *emptyInterfaceCodec) IsEmpty(ptr unsafe.Pointer) bool {
-	return ptr == nil
+	emptyInterface := (*emptyInterface)(ptr)
+	return emptyInterface.typ == nil
 }
 
 type nonEmptyInterfaceCodec struct {