From 3e20d40e9c41f9ab56151b4de1fcf9f44fbd028a Mon Sep 17 00:00:00 2001 From: Jakub Tomany <34450735+jakubtomany@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:38:15 +0200 Subject: [PATCH] fix: GetChild checks children length properly fixes the issue when GetChild is called with index == len(prc.children) Signed-off-by: Jakub Tomany <34450735+jakubtomany@users.noreply.github.com> --- runtime/Go/antlr/v4/parser_rule_context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/Go/antlr/v4/parser_rule_context.go b/runtime/Go/antlr/v4/parser_rule_context.go index c249bc1385..7e68ad4667 100644 --- a/runtime/Go/antlr/v4/parser_rule_context.go +++ b/runtime/Go/antlr/v4/parser_rule_context.go @@ -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] }