changeset 27163:0f11969a4d0f v8.2.4110

patch 8.2.4110: Coverity warns for using NULL pointer Commit: https://github.com/vim/vim/commit/8f9956994d5c75ed88d6b2881b6ac0bb62a0d6af Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 16 14:51:30 2022 +0000 patch 8.2.4110: Coverity warns for using NULL pointer Problem: Coverity warns for using NULL pointer. Solution: Check "evalarg" is not NULL. Skip errors when "verbose" is false.
author Bram Moolenaar <Bram@vim.org>
date Sun, 16 Jan 2022 16:00:07 +0100
parents b19230a8d40a
children 5008d16b633b
files src/eval.c src/version.c
diffstat 2 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/eval.c
+++ b/src/eval.c
@@ -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;
 			}
 		    }
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4110,
+/**/
     4109,
 /**/
     4108,