]> granicus.if.org Git - vim/commitdiff
patch 9.0.0628: Coverity warns for not checking return value v9.0.0628
authorBram Moolenaar <Bram@vim.org>
Fri, 30 Sep 2022 11:00:06 +0000 (12:00 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 30 Sep 2022 11:00:06 +0000 (12:00 +0100)
Problem:    Coverity warns for not checking return value.
Solution:   Check the return value and simplify the code.

src/version.c
src/vim9type.c

index a2e66b2d4fee352721b0593e0bf0cf056bb83ee0..73093f46e1f3c849b33b8d35296f9053003403a1 100644 (file)
@@ -699,6 +699,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    628,
 /**/
     627,
 /**/
index c4aec7b19a053af8855bacf0027b9e2a75826e26..771fbf54b96490b12ec8d4fb69a927e20865d8ad 100644 (file)
@@ -485,18 +485,13 @@ typval2type_int(typval_T *tv, int copyID, garray_T *type_gap, int flags)
                    {
                        type->tt_argcount -= tv->vval.v_partial->pt_argc;
                        type->tt_min_argcount -= tv->vval.v_partial->pt_argc;
-                       if (type->tt_argcount <= 0)
-                           type->tt_args = NULL;
-                       else
-                       {
-                           int i;
-
-                           func_type_add_arg_types(type, type->tt_argcount,
-                                                                    type_gap);
-                           for (i = 0; i < type->tt_argcount; ++i)
-                               type->tt_args[i] = ufunc->uf_func_type->tt_args[
+                       if (type->tt_argcount > 0
+                               && func_type_add_arg_types(type,
+                                           type->tt_argcount, type_gap) == OK)
+                           for (int i = 0; i < type->tt_argcount; ++i)
+                               type->tt_args[i] =
+                                       ufunc->uf_func_type->tt_args[
                                              i + tv->vval.v_partial->pt_argc];
-                       }
                    }
                    return type;
                }