Skip to content

Commit

Permalink
fix: GetChild checks children length properly
Browse files Browse the repository at this point in the history
fixes the issue when GetChild is called with index == len(prc.children)

Signed-off-by: Jakub Tomany <[email protected]>
  • Loading branch information
jakubtomany authored Aug 22, 2024
1 parent 811b7fd commit 3e20d40
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion runtime/Go/antlr/v4/parser_rule_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (prc *BaseParserRuleContext) AddErrorNode(badToken Token) *ErrorNodeImpl {
}

func (prc *BaseParserRuleContext) GetChild(i int) Tree {
if prc.children != nil && len(prc.children) >= i {
if prc.children != nil && len(prc.children) > i {
return prc.children[i]
}

Expand Down

0 comments on commit 3e20d40

Please sign in to comment.