summaryrefslogtreecommitdiffstats
path: root/src/list.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/list.c')
-rw-r--r--src/list.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/list.c b/src/list.c
index d1494c67d5..ce1ccaa1c0 100644
--- a/src/list.c
+++ b/src/list.c
@@ -415,6 +415,10 @@ list_find(list_T *l, long n)
CHECK_LIST_MATERIALIZE(l);
+ // range_list_materialize may reset l->lv_len
+ if (n >= l->lv_len)
+ return NULL;
+
// When there is a cached index may start search from there.
if (l->lv_u.mat.lv_idx_item != NULL)
{