aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-04-17 06:49:23 +0800
committerGitHub <noreply@github.com>2024-04-17 06:49:23 +0800
commit0b2b1b01850a18546508007edb87866714c85dde (patch)
tree44a6d3f04bed29952813c410e44a965f3c012f90 /src
parent329fc0e5b7f7777c405e4828650567a93620ba50 (diff)
downloadrneovim-0b2b1b01850a18546508007edb87866714c85dde.tar.gz
rneovim-0b2b1b01850a18546508007edb87866714c85dde.tar.bz2
rneovim-0b2b1b01850a18546508007edb87866714c85dde.zip
vim-patch:9.1.0340: Problem: Error with matchaddpos() and empty list (#28381)
Problem: Error with matchaddpos() and empty list (@rickhow) Solution: Return early for an empty list fixes: vim/vim#14525 closes: vim/vim#14563 https://github.com/vim/vim/commit/f7d31adcc22eae852d6e7a5b59e9755ba7b51d35 Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src')
-rw-r--r--src/nvim/match.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/match.c b/src/nvim/match.c
index ea8a1a05f4..580d7d1069 100644
--- a/src/nvim/match.c
+++ b/src/nvim/match.c
@@ -100,7 +100,7 @@ static int match_add(win_T *wp, const char *const grp, const char *const pat, in
// Build new match.
matchitem_T *m = xcalloc(1, sizeof(matchitem_T));
- if (pos_list != NULL) {
+ if (tv_list_len(pos_list) > 0) {
m->mit_pos_array = xcalloc((size_t)tv_list_len(pos_list), sizeof(llpos_T));
m->mit_pos_count = tv_list_len(pos_list);
}
@@ -1103,7 +1103,7 @@ void f_matchaddpos(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
list_T *l;
l = argvars[1].vval.v_list;
- if (l == NULL) {
+ if (tv_list_len(l) == 0) {
return;
}