diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-04-01 21:34:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-01 21:34:55 +0800 |
commit | 4f66530af1d5e501f7b57ddd79e9c185af1b5f39 (patch) | |
tree | 60f674cd4a84454a5027ac7414326b939ea92a72 /src/nvim/runtime.c | |
parent | 75e1b1d5c934aa3a12693a7df58795563fb7877e (diff) | |
download | rneovim-4f66530af1d5e501f7b57ddd79e9c185af1b5f39.tar.gz rneovim-4f66530af1d5e501f7b57ddd79e9c185af1b5f39.tar.bz2 rneovim-4f66530af1d5e501f7b57ddd79e9c185af1b5f39.zip |
vim-patch:9.0.1434: crash when adding package already in 'runtimepath' (#22849)
Problem: Crash when adding package already in 'runtimepath'.
Solution: Change order for using 'runtimepath' entries. (closes vim/vim#12215)
https://github.com/vim/vim/commit/39c9ec16ea7ef13c5d783481542ee9aa6c05282c
Diffstat (limited to 'src/nvim/runtime.c')
-rw-r--r-- | src/nvim/runtime.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c index c9667d58ed..5d1c104dc5 100644 --- a/src/nvim/runtime.c +++ b/src/nvim/runtime.c @@ -914,19 +914,6 @@ static int add_pack_dir_to_rtp(char *fname, bool is_pack) const char *cur_entry = entry; copy_option_part((char **)&entry, buf, MAXPATHL, ","); - if (insp == NULL) { - add_pathsep(buf); - char *const rtp_ffname = fix_fname(buf); - if (rtp_ffname == NULL) { - goto theend; - } - bool match = path_fnamencmp(rtp_ffname, ffname, fname_len) == 0; - xfree(rtp_ffname); - if (match) { - // Insert "ffname" after this entry (and comma). - insp = entry; - } - } if ((p = strstr(buf, "after")) != NULL && p > buf @@ -940,6 +927,20 @@ static int add_pack_dir_to_rtp(char *fname, bool is_pack) after_insp = cur_entry; break; } + + if (insp == NULL) { + add_pathsep(buf); + char *const rtp_ffname = fix_fname(buf); + if (rtp_ffname == NULL) { + goto theend; + } + bool match = path_fnamencmp(rtp_ffname, ffname, fname_len) == 0; + xfree(rtp_ffname); + if (match) { + // Insert "ffname" after this entry (and comma). + insp = entry; + } + } } if (insp == NULL) { |