summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index 39928568..67784f4d 100644
--- a/lib.c
+++ b/lib.c
@@ -3918,6 +3918,8 @@ val *vecref_l(val vec, val ind)
{
cnum index = c_num(ind);
cnum len = c_num(length_vec(vec));
+ if (index < 0)
+ index = len + index;
if (index < 0 || index >= len)
uw_throwf(error_s, lit("vecref: ~s is out of range for vector ~s"),
ind, vec, nao);