diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-12-27 23:04:16 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-12-27 23:04:16 -0800 |
commit | d2488974756c21c064ddd293fbb72d5a85b91e12 (patch) | |
tree | 2227deeebffff94136a0bcda897a46b01ac350c5 | |
parent | f5a48f7de36c0bbfb29da51af13bec2ed5a9ca7f (diff) | |
download | txr-d2488974756c21c064ddd293fbb72d5a85b91e12.tar.gz txr-d2488974756c21c064ddd293fbb72d5a85b91e12.tar.bz2 txr-d2488974756c21c064ddd293fbb72d5a85b91e12.zip |
Fix exception in @(freeform) over interactive input.
This is caused by the ("str0" "str1" .. "strn" nil)
representation put out by the interactive style lazy list.
The lazy string force function doesn't like the nil.
Quick and dirty fix applied here.
* lib.c (lazy_str_force, lazy_str_force_upto): If a nil comes
out of lstr->ls.list, break out of the loop as if the list
ended.
-rw-r--r-- | lib.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -6128,7 +6128,10 @@ val lazy_str_force(val lstr) term = car(lstr->ls.opts); while ((!lim || gt(lim, zero)) && lstr->ls.list) { - ptail = list_collect(ptail, pop(&lstr->ls.list)); + val next = pop(&lstr->ls.list); + if (!next) + break; + ptail = list_collect(ptail, next); ptail = list_collect(ptail, term); if (lim) lim = minus(lim, one); @@ -6166,6 +6169,8 @@ val lazy_str_force_upto(val lstr, val index) or2(null(lim),gt(lim,zero))) { val next = pop(&lstr->ls.list); + if (!next) + break; ptail = list_collect(ptail, next); ptail = list_collect(ptail, term); if (lim) |