0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.0.1617: Win32: :shell command in the GUI crashes

Problem:    Win32: :shell command in the GUI crashes.
Solution:   Handle the situation that "cmd" is NULL. (Yasuhiro Matsumoto,
            closes #2721)
This commit is contained in:
Bram Moolenaar
2018-03-19 21:44:37 +01:00
parent f05fa37822
commit 42f652f733
2 changed files with 16 additions and 4 deletions

View File

@@ -4800,15 +4800,25 @@ mch_call_shell_terminal(
aco_save_T aco;
oparg_T oa; /* operator arguments */
if (cmd == NULL)
cmdlen = STRLEN(p_sh) + 1;
else
cmdlen = STRLEN(p_sh) + STRLEN(p_shcf) + STRLEN(cmd) + 10;
newcmd = lalloc(cmdlen, TRUE);
if (newcmd == NULL)
return 255;
if (cmd == NULL)
{
STRCPY(newcmd, p_sh);
ch_log(NULL, "starting terminal to run a shell");
}
else
{
vim_snprintf((char *)newcmd, cmdlen, "%s %s %s", p_sh, p_shcf, cmd);
ch_log(NULL, "starting terminal for system command '%s'", cmd);
}
init_job_options(&opt);
ch_log(NULL, "starting terminal for system command '%s'", cmd);
argvar[0].v_type = VAR_STRING;
argvar[0].vval.v_string = newcmd;

View File

@@ -766,6 +766,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1617,
/**/
1616,
/**/