Mercurial > vim
comparison src/vim9execute.c @ 28273:fff70771d4bb v8.2.4662
patch 8.2.4662: no error for using out of range list index
Commit: https://github.com/vim/vim/commit/22ebd172e48ba060c8a7bae3dbf6480b7596d937
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Apr 1 15:26:58 2022 +0100
patch 8.2.4662: no error for using out of range list index
Problem: No error for using out of range list index.
Solution: Check list index at script level like in compiled function.
(closes #10051)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 01 Apr 2022 16:30:03 +0200 |
parents | c446812efd60 |
children | c4b2aa8e1ee1 |
comparison
equal
deleted
inserted
replaced
28272:bb583103b95b | 28273:fff70771d4bb |
---|---|
1986 && tv_idx2->vval.v_number == VVAL_NONE) | 1986 && tv_idx2->vval.v_number == VVAL_NONE) |
1987 n2 = list_len(tv_dest->vval.v_list) - 1; | 1987 n2 = list_len(tv_dest->vval.v_list) - 1; |
1988 else | 1988 else |
1989 n2 = (long)tv_get_number_chk(tv_idx2, NULL); | 1989 n2 = (long)tv_get_number_chk(tv_idx2, NULL); |
1990 | 1990 |
1991 li1 = check_range_index_one(tv_dest->vval.v_list, &n1, FALSE); | 1991 li1 = check_range_index_one(tv_dest->vval.v_list, &n1, TRUE, FALSE); |
1992 if (li1 == NULL) | 1992 if (li1 == NULL) |
1993 status = FAIL; | 1993 status = FAIL; |
1994 else | 1994 else |
1995 { | 1995 { |
1996 status = check_range_index_two(tv_dest->vval.v_list, | 1996 status = check_range_index_two(tv_dest->vval.v_list, |