From 728c5fcf170dbadd72a18afb78f53e98523f3e2b Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 9 Sep 2020 13:05:00 +0200 Subject: [PATCH] Fix empty name in config block directive --- config.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/config.go b/config.go index f802747..582b74e 100644 --- a/config.go +++ b/config.go @@ -82,7 +82,14 @@ func Parse(r io.Reader) (*Directive, error) { var d *Directive if words[len(words)-1] == "{" && l[len(l)-1] == '{' { words = words[:len(words)-1] - d = &Directive{Params: words} + + var name string + params := words + if len(words) > 0 { + name, params = words[0], words[1:] + } + + d = &Directive{Name: name, Params: params} cur = d directives = append(directives, d) } else {