From d2488974756c21c064ddd293fbb72d5a85b91e12 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 27 Dec 2015 23:04:16 -0800 Subject: 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. --- lib.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib.c') 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) -- cgit v1.2.3