From eae3c305a775efc2d04495199704957964f3a644 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Fri, 7 Sep 2018 21:06:51 +0200 Subject: Don't segfault if the line is empty (#8906) --- compiler/llstream.nim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'compiler/llstream.nim') diff --git a/compiler/llstream.nim b/compiler/llstream.nim index 42bbb7600..9cd329320 100644 --- a/compiler/llstream.nim +++ b/compiler/llstream.nim @@ -87,9 +87,9 @@ proc endsWithOpr*(x: string): bool = result = x.endsWith(LineContinuationOprs) proc continueLine(line: string, inTripleString: bool): bool {.inline.} = - result = inTripleString or - line[0] == ' ' or - line.endsWith(LineContinuationOprs+AdditionalLineContinuationOprs) + result = inTripleString or line.len > 0 and ( + line[0] == ' ' or + line.endsWith(LineContinuationOprs+AdditionalLineContinuationOprs)) proc countTriples(s: string): int = var i = 0 -- cgit 1.4.1-2-gfad0