diff --git a/contributors.txt b/contributors.txt index ccd9304934..ac3f69f904 100644 --- a/contributors.txt +++ b/contributors.txt @@ -318,4 +318,5 @@ YYYY/MM/DD, github id, Full name, email 2021/09/23, skalt, Steven Kalt, kalt.steven@gmail.com 2021/10/10, tools4origins, Erwan Guyomarc'h, contact@erwan-guyomarch.fr 2021/10/19, jcking, Justin King, jcking@google.com -2021/10/31, skef, Skef Iterum, github@skef.org \ No newline at end of file +2021/10/31, skef, Skef Iterum, github@skef.org +2022/02/10, mattwiller, Matt Willer, matt.r.willer@gmail.com \ No newline at end of file diff --git a/runtime/Go/antlr/error_strategy.go b/runtime/Go/antlr/error_strategy.go index 977a6e4549..debf4b0bd4 100644 --- a/runtime/Go/antlr/error_strategy.go +++ b/runtime/Go/antlr/error_strategy.go @@ -738,7 +738,11 @@ func (b *BailErrorStrategy) Recover(recognizer Parser, e RecognitionException) { context := recognizer.GetParserRuleContext() for context != nil { context.SetException(e) - context = context.GetParent().(ParserRuleContext) + if parent, ok := context.GetParent().(ParserRuleContext); ok { + context = parent + } else { + context = nil + } } panic(NewParseCancellationException()) // TODO we don't emit e properly }