Skip to content

Commit

Permalink
Merge pull request #91 from magiusdarrigo/magius/nil-check-global-patch
Browse files Browse the repository at this point in the history
patch: add nil check for grammer field before g.BlockSyntax call
  • Loading branch information
danog authored Oct 17, 2024
2 parents b975919 + 820446c commit 69a6f0e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ func (c Config) parseTokens(tokens []Token) (ASTNode, Error) { // nolint: gocycl
case tok.Type == TextTokenType:
*ap = append(*ap, &ASTText{Token: tok})
case tok.Type == TagTokenType:
if g == nil {
return nil, Errorf(tok, "Grammer field is nil")
}
if cs, ok := g.BlockSyntax(tok.Name); ok {
switch {
case tok.Name == "comment":
Expand Down

0 comments on commit 69a6f0e

Please sign in to comment.