Przeglądaj źródła

fix handling of nil empty interface

Jason Toffaletti 8 lat temu
rodzic
commit
005d86dc44
1 zmienionych plików z 2 dodań i 1 usunięć
  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 {