Commits

Anonymous committed efb0ae9

Fix infinite loop

Comments (0)

Files changed (1)

src/cajole/editor.cljs

         sum-lengths #(apply + %)
         under-nodes (loop [accum [] lengths (goog.array.map nodes #(count (dom/getTextContent %)))]
                       (let [total (+ (sum-lengths accum) (first lengths))]
-                        (if (and (count lengths) (< total pos))
+                        (if (and (> (count lengths) 0) (< total pos))
                           (recur (cons (first lengths) accum) (rest lengths))
                           accum)))
         node (aget nodes (count under-nodes))]