patch 9.1.1401: list not materialized in prop_list()
Problem: list not materialized in prop_list()
(Nickwiz)
Solution: materialize list before accessing it
fixes: #17298
closes: #17349
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@ -4757,4 +4757,29 @@ func Test_textprop_with_wincolor()
|
|||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_textprop_materialize_list()
|
||||||
|
let ids = range(3)
|
||||||
|
call assert_equal([], prop_list(1, #{ids: ids}))
|
||||||
|
|
||||||
|
let ids = range(3) + []
|
||||||
|
call assert_equal([], prop_list(1, #{ids: ids}))
|
||||||
|
|
||||||
|
let ids = range(3)
|
||||||
|
let ids[0] = ids[0]
|
||||||
|
call assert_equal([], prop_list(1, #{ids: ids}))
|
||||||
|
|
||||||
|
let ids = range(3)
|
||||||
|
call assert_equal([], prop_list(1, #{ids: ids}))
|
||||||
|
|
||||||
|
call assert_equal([], prop_list(1, #{ids: range(3) + [] }))
|
||||||
|
|
||||||
|
let ids = range(3)
|
||||||
|
call assert_equal([], prop_list(1, #{ids: ids}))
|
||||||
|
|
||||||
|
let ids = range(0, 3)
|
||||||
|
call assert_equal([], prop_list(1, #{ids: ids}))
|
||||||
|
|
||||||
|
call assert_equal([], prop_list(1, #{ids: 3->range()}))
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
|||||||
@ -1439,7 +1439,7 @@ get_prop_ids_from_list(list_T *l, int *num_ids)
|
|||||||
{
|
{
|
||||||
int *prop_ids;
|
int *prop_ids;
|
||||||
listitem_T *li;
|
listitem_T *li;
|
||||||
int i;
|
int i = 0;
|
||||||
int id;
|
int id;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
@ -1449,7 +1449,7 @@ get_prop_ids_from_list(list_T *l, int *num_ids)
|
|||||||
if (prop_ids == NULL)
|
if (prop_ids == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
i = 0;
|
CHECK_LIST_MATERIALIZE(l);
|
||||||
FOR_ALL_LIST_ITEMS(l, li)
|
FOR_ALL_LIST_ITEMS(l, li)
|
||||||
{
|
{
|
||||||
error = FALSE;
|
error = FALSE;
|
||||||
|
|||||||
@ -709,6 +709,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1401,
|
||||||
/**/
|
/**/
|
||||||
1400,
|
1400,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user