Skip to content

Commit 4d5c126

Browse files
committed
patch 8.1.2061: MS-Windows GUI: ":sh" crashes when trying to use a terminal
Problem: MS-Windows GUI: ":sh" crashes when trying to use a terminal. Solution: Check for a NULL command. (Yasuhiro Matsumoto, closes #4958)
1 parent bffba7f commit 4d5c126

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/os_win32.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4657,12 +4657,14 @@ mch_call_shell(
46574657
{
46584658
char_u *cmdbase = cmd;
46594659

4660-
// Skip a leading quote and (.
4661-
while (*cmdbase == '"' || *cmdbase == '(')
4662-
++cmdbase;
4660+
if (cmdbase != NULL)
4661+
// Skip a leading quote and (.
4662+
while (*cmdbase == '"' || *cmdbase == '(')
4663+
++cmdbase;
46634664

46644665
// Check the command does not begin with "start "
4665-
if (STRNICMP(cmdbase, "start", 5) != 0 || !VIM_ISWHITE(cmdbase[5]))
4666+
if (cmdbase == NULL
4667+
|| STRNICMP(cmdbase, "start", 5) != 0 || !VIM_ISWHITE(cmdbase[5]))
46664668
{
46674669
// Use a terminal window to run the command in.
46684670
x = mch_call_shell_terminal(cmd, options);

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,8 @@ static char *(features[]) =
757757

758758
static int included_patches[] =
759759
{ /* Add new patch number below this line */
760+
/**/
761+
2061,
760762
/**/
761763
2060,
762764
/**/

0 commit comments

Comments
 (0)