func (e *encoder) marshal(tag string, in reflect.Value) should not try to perform any operations (call MarshalYAML() or MarshalText()) on nil pointers
@@ -60,7 +60,7 @@ func (e *encoder) must(ok bool) {
}
func (e *encoder) marshal(tag string, in reflect.Value) {
- if !in.IsValid() {
+ if !in.IsValid() || in.Kind() == reflect.Ptr && in.IsNil() {
e.nilv()
return