Merge pull request #2810 from Shell32-Natsu/fieldspec-empty

fix panic when fieldspec refers an empty value
This commit is contained in:
Jeff Regan
2020-08-07 11:50:14 -07:00
committed by GitHub
3 changed files with 60 additions and 0 deletions

View File

@@ -468,6 +468,9 @@ func (s FieldSetter) Filter(rn *RNode) (*RNode, error) {
if err := ErrorIfInvalid(rn, yaml.ScalarNode); err != nil {
return rn, err
}
if IsMissingOrNull(s.Value) {
return rn, nil
}
// only apply the style if there is not an existing style
// or we want to override it
if !s.OverrideStyle || s.Value.YNode().Style == 0 {