Fix unmarshaler handling of empty strings.
diff --git a/decode.go b/decode.go index 085cddc..b13ab9f 100644 --- a/decode.go +++ b/decode.go
@@ -251,7 +251,7 @@ // // If n holds a null value, prepare returns before doing anything. func (d *decoder) prepare(n *node, out reflect.Value) (newout reflect.Value, unmarshaled, good bool) { - if n.tag == yaml_NULL_TAG || n.kind == scalarNode && n.tag == "" && (n.value == "null" || n.value == "") { + if n.tag == yaml_NULL_TAG || n.kind == scalarNode && n.tag == "" && (n.value == "null" || n.value == "" && n.implicit) { return out, false, false } again := true
diff --git a/decode_test.go b/decode_test.go index c159760..3da6fad 100644 --- a/decode_test.go +++ b/decode_test.go
@@ -660,6 +660,7 @@ {`_: BAR!`, "!!str", "BAR!"}, {`_: "BAR!"`, "!!str", "BAR!"}, {"_: !!foo 'BAR!'", "!!foo", "BAR!"}, + {`_: ""`, "!!str", ""}, } var unmarshalerResult = map[int]error{}