summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorLemonBoy <LemonBoy@users.noreply.github.com>2018-09-07 21:06:51 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-09-07 21:06:51 +0200
commiteae3c305a775efc2d04495199704957964f3a644 (patch)
tree937e7409c965d8671105c83c5abe92e9435b67e9 /compiler
parente69d8ec416f9be8004a7ef37a3cf44edf8258585 (diff)
downloadNim-eae3c305a775efc2d04495199704957964f3a644.tar.gz
Don't segfault if the line is empty (#8906)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/llstream.nim6
1 files changed, 3 insertions, 3 deletions
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