summaryrefslogtreecommitdiff
path: root/src/os_win32.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-09-20 17:20:02 +0200
committerBram Moolenaar <Bram@vim.org>2019-09-20 17:20:02 +0200
commit4d5c12626c98df23e1a5d953692d946310ddfa9c (patch)
treee86270474116aff5cb8c16f5b1fdef1e7c587d96 /src/os_win32.c
parentbffba7f7042f6082e75b42484b15f66087b01941 (diff)
downloadvim-git-4d5c12626c98df23e1a5d953692d946310ddfa9c.tar.gz
patch 8.1.2061: MS-Windows GUI: ":sh" crashes when trying to use a terminalv8.1.2061
Problem: MS-Windows GUI: ":sh" crashes when trying to use a terminal. Solution: Check for a NULL command. (Yasuhiro Matsumoto, closes #4958)
Diffstat (limited to 'src/os_win32.c')
-rw-r--r--src/os_win32.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/os_win32.c b/src/os_win32.c
index ae77e40eb..39b86d6ab 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -4657,12 +4657,14 @@ mch_call_shell(
{
char_u *cmdbase = cmd;
- // Skip a leading quote and (.
- while (*cmdbase == '"' || *cmdbase == '(')
- ++cmdbase;
+ if (cmdbase != NULL)
+ // Skip a leading quote and (.
+ while (*cmdbase == '"' || *cmdbase == '(')
+ ++cmdbase;
// Check the command does not begin with "start "
- if (STRNICMP(cmdbase, "start", 5) != 0 || !VIM_ISWHITE(cmdbase[5]))
+ if (cmdbase == NULL
+ || STRNICMP(cmdbase, "start", 5) != 0 || !VIM_ISWHITE(cmdbase[5]))
{
// Use a terminal window to run the command in.
x = mch_call_shell_terminal(cmd, options);