Skip to content

Commit 8fb689e

Browse files
committed
fix: GetChild checks children length properly
fixes the issue when GetChild is called with index == len(prc.children) Signed-off-by: Jakub Tomany <[email protected]>
1 parent 5435f14 commit 8fb689e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

runtime/Go/antlr/v4/parser_rule_context.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ func (prc *BaseParserRuleContext) AddErrorNode(badToken Token) *ErrorNodeImpl {
161161
}
162162

163163
func (prc *BaseParserRuleContext) GetChild(i int) Tree {
164-
if prc.children != nil && len(prc.children) >= i {
164+
if prc.children != nil && len(prc.children) > i {
165165
return prc.children[i]
166166
}
167167

0 commit comments

Comments
 (0)