checks if specs exist before accessing them in genDecl printer

This commit is contained in:
Patrick Barker 2019-03-13 20:34:48 -06:00
parent bf94fc3ae3
commit 54cf699c96
1 changed files with 1 additions and 1 deletions

View File

@ -1568,7 +1568,7 @@ func (p *printer) genDecl(d *ast.GenDecl) {
}
p.print(d.Rparen, token.RPAREN)
} else {
} else if len(d.Specs) > 0 {
// single declaration
p.spec(d.Specs[0], 1, true)
}