summaryrefslogtreecommitdiffstats
path: root/src/evalvars.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-09-27 14:22:48 +0200
committerBram Moolenaar <Bram@vim.org>2020-09-27 14:22:48 +0200
commitc0e29010f68a0ebe439f9bd78493799c60b7bfd3 (patch)
treede28c56983955b5bdbed61c7b1fe15bb666439c9 /src/evalvars.c
parent8c7ad3631af570f68b2da2658cf966a9a19cb6c4 (diff)
patch 8.2.1755: Vim9: crash when using invalid heredoc markerv8.2.1755
Problem: Vim9: crash when using invalid heredoc marker. (Dhiraj Mishra) Solution: Check for NULL list. (closes #7027) Fix comment character.
Diffstat (limited to 'src/evalvars.c')
-rw-r--r--src/evalvars.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/evalvars.c b/src/evalvars.c
index 3571169370..9aa6d6554a 100644
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -558,6 +558,7 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get)
int text_indent_len = 0;
char_u *text_indent = NULL;
char_u dot[] = ".";
+ int comment_char = in_vim9script() ? '#' : '"';
if (eap->getline == NULL)
{
@@ -585,11 +586,11 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get)
}
// The marker is the next word.
- if (*cmd != NUL && *cmd != '"')
+ if (*cmd != NUL && *cmd != comment_char)
{
marker = skipwhite(cmd);
p = skiptowhite(marker);
- if (*skipwhite(p) != NUL && *skipwhite(p) != '"')
+ if (*skipwhite(p) != NUL && *skipwhite(p) != comment_char)
{
semsg(_(e_trailing_arg), p);
return NULL;