summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-12-27 23:04:16 -0800
committerKaz Kylheku <kaz@kylheku.com>2015-12-27 23:04:16 -0800
commitd2488974756c21c064ddd293fbb72d5a85b91e12 (patch)
tree2227deeebffff94136a0bcda897a46b01ac350c5 /lib.c
parentf5a48f7de36c0bbfb29da51af13bec2ed5a9ca7f (diff)
downloadtxr-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.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib.c b/lib.c
index 2aa5029d..75c77827 100644
--- a/lib.c
+++ b/lib.c
@@ -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)