summary refs log tree commit diff stats
path: root/compiler/ropes.nim
diff options
context:
space:
mode:
authorkoranza <stflynn@hotmail.com>2018-05-18 16:20:13 -0500
committerGitHub <noreply@github.com>2018-05-18 16:20:13 -0500
commit39988eb1cfae043271376bd21fa301ba2115b59c (patch)
tree661b2410afde62935766ccdf1f1803a1e8e7715f /compiler/ropes.nim
parentb75008292506d49f2641550457354267e11e1116 (diff)
parent06bdf8392bd3e597dbe3ef12c7a819b60e32d7ac (diff)
downloadNim-39988eb1cfae043271376bd21fa301ba2115b59c.tar.gz
Merge pull request #1 from nim-lang/devel
updating my fork with the head repo
Diffstat (limited to 'compiler/ropes.nim')
-rw-r--r--compiler/ropes.nim6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/ropes.nim b/compiler/ropes.nim
index 358ce8a53..05d5e840c 100644
--- a/compiler/ropes.nim
+++ b/compiler/ropes.nim
@@ -188,11 +188,11 @@ iterator leaves*(r: Rope): string =
     var stack = @[r]
     while stack.len > 0:
       var it = stack.pop
-      while isNil(it.data):
+      while it.left != nil:
+        assert it.right != nil
         stack.add(it.right)
         it = it.left
         assert(it != nil)
-      assert(it.data != nil)
       yield it.data
 
 iterator items*(r: Rope): char =
@@ -251,7 +251,7 @@ proc `%`*(frmt: FormatStr, 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
         num = j
         if j > high(args) + 1:
           errorHandler(rInvalidFormatStr, $(j))