summary refs log tree commit diff stats
path: root/lib/pure/ropes.nim
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2020-11-24 02:23:52 +0800
committerGitHub <noreply@github.com>2020-11-23 19:23:52 +0100
commit0c6c4be0e783893cc21352fa686fb18c158d3e43 (patch)
treed9b43a4aba45ae1f26b36c04be46204dc8c3a731 /lib/pure/ropes.nim
parent7fc0c3dfbf5e27805fa75745acabf5ce2f0af693 (diff)
downloadNim-0c6c4be0e783893cc21352fa686fb18c158d3e43.tar.gz
fix ropes format errors (#16106) [backport:1.0]
* fix rope index

* add testcase

* fix ropes format
Diffstat (limited to 'lib/pure/ropes.nim')
-rw-r--r--lib/pure/ropes.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/pure/ropes.nim b/lib/pure/ropes.nim
index 0797bbe06..a39533e58 100644
--- a/lib/pure/ropes.nim
+++ b/lib/pure/ropes.nim
@@ -262,7 +262,7 @@ proc `%`*(frmt: string, args: openArray[Rope]): Rope {.
         while true:
           j = j * 10 + ord(frmt[i]) - ord('0')
           inc(i)
-          if frmt[i] notin {'0'..'9'}: break
+          if i >= frmt.len or frmt[i] notin {'0'..'9'}: break
         add(result, args[j-1])
       of '{':
         inc(i)