diff src/os_win32.c @ 18133:d683b2c82c00 v8.1.2061

patch 8.1.2061: MS-Windows GUI: ":sh" crashes when trying to use a terminal Commit: https://github.com/vim/vim/commit/4d5c12626c98df23e1a5d953692d946310ddfa9c Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 20 17:20:02 2019 +0200 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 https://github.com/vim/vim/issues/4958)
author Bram Moolenaar <Bram@vim.org>
date Fri, 20 Sep 2019 17:30:03 +0200
parents 8b4f9be5db73
children 59bc3cd42cf5
line wrap: on
line diff
--- 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);