diff options
author | Famiu Haque <famiuhaque@protonmail.com> | 2022-08-10 16:37:59 +0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-10 18:37:59 +0800 |
commit | 78658ef3834baf7d202eb16a8778813e08e58412 (patch) | |
tree | 1d0bb581b78eebb905daa5868672ce9fda2a7949 /src/nvim/api/command.c | |
parent | 3ee6c05b4b5fa253bdf64fff68c71763b5d816b7 (diff) | |
download | rneovim-78658ef3834baf7d202eb16a8778813e08e58412.tar.gz rneovim-78658ef3834baf7d202eb16a8778813e08e58412.tar.bz2 rneovim-78658ef3834baf7d202eb16a8778813e08e58412.zip |
fix(api): `vim.cmd.make` crashes when argument count isn't 1 (#19701)
Closes #19696
Diffstat (limited to 'src/nvim/api/command.c')
-rw-r--r-- | src/nvim/api/command.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/api/command.c b/src/nvim/api/command.c index bc766ff39c..fc1f6a04f2 100644 --- a/src/nvim/api/command.c +++ b/src/nvim/api/command.c @@ -819,9 +819,12 @@ static void build_cmdline_str(char **cmdlinep, exarg_T *eap, CmdParseInfo *cmdin char *p = replace_makeprg(eap, eap->arg, cmdlinep); if (p != eap->arg) { // If replace_makeprg modified the cmdline string, correct the argument pointers. - assert(argc == 1); eap->arg = p; - eap->args[0] = p; + // We can only know the position of the first argument because the argument list can be used + // multiple times in makeprg / grepprg. + if (argc >= 1) { + eap->args[0] = p; + } } } |