]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.4110: Coverity warns for using NULL pointer v8.2.4110
authorBram Moolenaar <Bram@vim.org>
Sun, 16 Jan 2022 14:51:30 +0000 (14:51 +0000)
committerBram Moolenaar <Bram@vim.org>
Sun, 16 Jan 2022 14:51:30 +0000 (14:51 +0000)
Problem:    Coverity warns for using NULL pointer.
Solution:   Check "evalarg" is not NULL.  Skip errors when "verbose" is false.

src/eval.c
src/version.c

index 5588abd026048fd7b571464ae67cf5811bbf648a..935f19aa761c7572d990ce96b07421fa990b0445 100644 (file)
@@ -3973,8 +3973,8 @@ eval_method(
            int         len2;
            char_u      *fname;
            int         idx;
-           imported_T  *import = find_imported(name, len,
-                                                    TRUE, evalarg->eval_cctx);
+           imported_T  *import = find_imported(name, len, TRUE,
+                                 evalarg == NULL ? NULL : evalarg->eval_cctx);
            type_T      *type;
 
            // value->import.func()
@@ -3986,10 +3986,11 @@ eval_method(
                len2 = get_name_len(arg, &alias, evaluate, TRUE);
                if (len2 <= 0)
                {
-                   emsg(_(e_missing_name_after_dot));
+                   if (verbose)
+                       emsg(_(e_missing_name_after_dot));
                    ret = FAIL;
                }
-               else
+               else if (evaluate)
                {
                    int     cc = fname[len2];
                    ufunc_T *ufunc;
@@ -4014,7 +4015,8 @@ eval_method(
                        else
                        {
                            // TODO: how about a partial?
-                           semsg(_(e_not_callable_type_str), fname);
+                           if (verbose)
+                               semsg(_(e_not_callable_type_str), fname);
                            ret = FAIL;
                        }
                    }
index bffed683c71c43870ee1e5750deeb0687fd8529d..b658ec7ae52843b4c8e26112b95965ecaecc5a21 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4110,
 /**/
     4109,
 /**/