0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.0168: Coverity warning for assigning NULL to an option

Problem:    Coverity warning for assigning NULL to an option.
Solution:   Use empty string instead of NULL.
This commit is contained in:
Bram Moolenaar
2020-01-28 22:52:48 +01:00
parent 58ceca5cae
commit 97a2af39cd
3 changed files with 8 additions and 0 deletions

View File

@@ -644,6 +644,8 @@ def Test_expr7_option()
set ts=8
set grepprg=some\ text
assert_equal('some text', &grepprg)
&grepprg = test_null_string()
assert_equal('', &grepprg)
set grepprg&
enddef

View File

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

View File

@@ -625,7 +625,11 @@ call_def_function(
--ectx.ec_stack.ga_len;
tv = STACK_TV_BOT(0);
if (tv->v_type == VAR_STRING)
{
s = tv->vval.v_string;
if (s == NULL)
s = (char_u *)"";
}
else if (tv->v_type == VAR_NUMBER)
n = tv->vval.v_number;
else