summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-01-05 14:35:53 -0800
committerKaz Kylheku <kaz@kylheku.com>2018-01-05 14:35:53 -0800
commitc6c6e15e9f13e45bc7a1e2626ca41e03f0ba0983 (patch)
tree58ed5d37629925ea47c6be8fc6f6b3da24c74c37 /lib.c
parent81abe0f260dcfb4bb5d6b9f5ddf358a65e960cab (diff)
downloadtxr-c6c6e15e9f13e45bc7a1e2626ca41e03f0ba0983.tar.gz
txr-c6c6e15e9f13e45bc7a1e2626ca41e03f0ba0983.tar.bz2
txr-c6c6e15e9f13e45bc7a1e2626ca41e03f0ba0983.zip
nthcdr: terminate loop if end of list hit.
* lib.c (nthcdr): Terminate loop when nil is hit rather than continuing to count down to zero.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib.c b/lib.c
index 31351fba..f70372fb 100644
--- a/lib.c
+++ b/lib.c
@@ -726,7 +726,7 @@ val nthcdr(val pos, val list)
gc_hint(list);
- while (n-- > 0)
+ while (list && n-- > 0)
list = cdr(list);
return list;