aboutsummaryrefslogtreecommitdiff
path: root/src/format.nim
diff options
context:
space:
mode:
authorzqqw2020-05-27 01:29:29 +0000
committerzqqw2020-05-27 01:29:29 +0000
commit36e59748983034d5d39293e5d2415e92c14e2a22 (patch)
treea91fc7b21082f0609faf47e048b2bdf0cfaef1a8 /src/format.nim
parent85382cae3cd98f3fc4a0925482da182681aabc8d (diff)
Fix -Ss index out of bounds, the container is empty [IndexError] (runeOffset: empty description field)
Diffstat (limited to 'src/format.nim')
-rw-r--r--src/format.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/format.nim b/src/format.nim
index 5c8e336..b8061f9 100644
--- a/src/format.nim
+++ b/src/format.nim
@@ -83,7 +83,9 @@ proc splitLines(text: string, lineSize: int, lines: seq[string] = @[]): seq[stri
if not addBreaks:
lines & text
else:
- let offset = text.runeOffset(lineSize)
+ var offset : int = -1
+ if text.len() != 0:
+ offset = text.runeOffset(lineSize)
if offset < 0:
lines & text
else: