summaryrefslogtreecommitdiff
path: root/src/scriptfile.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-01 13:52:03 +0100
committerBram Moolenaar <Bram@vim.org>2023-04-01 13:52:03 +0100
commit39c9ec16ea7ef13c5d783481542ee9aa6c05282c (patch)
treefff76b9c362d6c7136ab37d72072468334a8dac4 /src/scriptfile.c
parent869113f3765d51fc822a61b2ba53d339797c1231 (diff)
downloadvim-git-9.0.1434.tar.gz
patch 9.0.1434: crash when adding package already in 'runtimepath'v9.0.1434
Problem: Crash when adding package already in 'runtimepath'. Solution: Change order for using 'runtimepath' entries. (closes #12215)
Diffstat (limited to 'src/scriptfile.c')
-rw-r--r--src/scriptfile.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/scriptfile.c b/src/scriptfile.c
index dd4a35236..0afe20110 100644
--- a/src/scriptfile.c
+++ b/src/scriptfile.c
@@ -718,18 +718,6 @@ add_pack_dir_to_rtp(char_u *fname)
char_u *cur_entry = entry;
copy_option_part(&entry, buf, MAXPATHL, ",");
- if (insp == NULL)
- {
- add_pathsep(buf);
- rtp_ffname = fix_fname(buf);
- if (rtp_ffname == NULL)
- goto theend;
- match = vim_fnamencmp(rtp_ffname, ffname, fname_len) == 0;
- vim_free(rtp_ffname);
- if (match)
- // Insert "ffname" after this entry (and comma).
- insp = entry;
- }
if ((p = (char_u *)strstr((char *)buf, "after")) != NULL
&& p > buf
@@ -743,6 +731,19 @@ add_pack_dir_to_rtp(char_u *fname)
after_insp = cur_entry;
break;
}
+
+ if (insp == NULL)
+ {
+ add_pathsep(buf);
+ rtp_ffname = fix_fname(buf);
+ if (rtp_ffname == NULL)
+ goto theend;
+ match = vim_fnamencmp(rtp_ffname, ffname, fname_len) == 0;
+ vim_free(rtp_ffname);
+ if (match)
+ // Insert "ffname" after this entry (and comma).
+ insp = entry;
+ }
}
if (insp == NULL)