]> granicus.if.org Git - vim/commitdiff
patch 8.2.0168: Coverity warning for assigning NULL to an option v8.2.0168
authorBram Moolenaar <Bram@vim.org>
Tue, 28 Jan 2020 21:52:48 +0000 (22:52 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 28 Jan 2020 21:52:48 +0000 (22:52 +0100)
Problem:    Coverity warning for assigning NULL to an option.
Solution:   Use empty string instead of NULL.

src/testdir/test_vim9_expr.vim
src/version.c
src/vim9execute.c

index 321dbf95ab5fc085877e08e6e01f577b04c561d1..8776e07474b8861736af6efc0388def09175f979 100644 (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
 
index c6259bc9f5ef7275ad3a167c400fa27814e95a80..231640caa71812a851ba84a4419c8af570ae3a35 100644 (file)
@@ -742,6 +742,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    168,
 /**/
     167,
 /**/
index 6865ba1e24acb3a23807c815e7f0f93fdbe8763c..480f1ec565c2a5589f49bc41c8b367cad14cabc7 100644 (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