diff --git a/parser/parser.go b/parser/parser.go index 2920219..ad6f9a8 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -714,7 +714,10 @@ func (p *parser) parse(isRoot bool) (result []*ast.Node, endPos ast.Position, er return nil, ast.Position{}, err } if len(vals) != 1 { - return nil, ast.Position{}, fmt.Errorf("multiple-string value not supported (%v). Please add comma explcitily, see http://b/162070952", vals) + return nil, ast.Position{}, fmt.Errorf("multiple-string value not supported (%v). Please add comma explicitly, see http://b/162070952", vals) + } + if len(vals[0].Value) == 0 { + return nil, ast.Position{}, fmt.Errorf("empty value in list") } vals[0].PreComments = append(vals[0].PreComments, preComments...) diff --git a/parser/parser_test.go b/parser/parser_test.go index c3f8965..5390477 100644 --- a/parser/parser_test.go +++ b/parser/parser_test.go @@ -26,6 +26,8 @@ func TestError(t *testing.T) { }, { in: `name: "string with literal new line "`, err: "new line", + }, { + in: `list_with_empty_list: [a,,b]`, err: "empty value in list", }} for _, input := range inputs { out, err := Format([]byte(input.in))