From 81cdda842c9566c57b075f211793495358b53094 Mon Sep 17 00:00:00 2001 From: Henrixounez Date: Fri, 9 Aug 2019 20:19:37 +0200 Subject: [PATCH] compiler: fix panic on open bracket without newline --- compiler/parser.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/parser.v b/compiler/parser.v index 8a8d787d46..34fe7f97cf 100644 --- a/compiler/parser.v +++ b/compiler/parser.v @@ -769,7 +769,7 @@ fn (p mut Parser) check(expected Token) { } p.fgen(p.strtok()) // vfmt: increase indentation on `{` unless it's `{}` - if expected == .lcbr && p.scanner.text[p.scanner.pos + 1] != `}` { + if expected == .lcbr && p.scanner.pos + 1 < p.scanner.text.len && p.scanner.text[p.scanner.pos + 1] != `}` { p.fgenln('') p.fmt_inc() }