Fix empty name in config block directive

This commit is contained in:
Simon Ser 2020-09-09 13:05:00 +02:00
parent 8d2b9202b5
commit 728c5fcf17
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
1 changed files with 8 additions and 1 deletions

View File

@ -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 {