compiler: fix panic on open bracket without newline

pull/1552/head
Henrixounez 2019-08-09 20:19:37 +02:00 committed by Alexander Medvednikov
parent 5c29a7ef7d
commit 81cdda842c
1 changed files with 1 additions and 1 deletions

View File

@ -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()
}