diff --git a/internal/encoder/compiler.go b/internal/encoder/compiler.go index 3ae39ba..e234350 100644 --- a/internal/encoder/compiler.go +++ b/internal/encoder/compiler.go @@ -668,7 +668,7 @@ func (c *Compiler) structFieldCode(structCode *StructCode, tag *runtime.StructTa } fieldCode.value = code fieldCode.isAddrForMarshaler = true - fieldCode.isNilCheck = false + fieldCode.isNilCheck = true case isPtr && c.isPtrMarshalTextType(fieldType): // *struct{ field T } // func (*T) MarshalText() ([]byte, error)