summaryrefslogtreecommitdiffstats
path: root/src/vim9type.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-09-30 12:00:06 +0100
committerBram Moolenaar <Bram@vim.org>2022-09-30 12:00:06 +0100
commitd0121c63cfb0922a7048ece3efe994df6f444bed (patch)
tree9682307a1dccd41b20cc190e220c205c4a387bc6 /src/vim9type.c
parent6586a015144f15a979d573a79d91e700e4b3009f (diff)
patch 9.0.0628: Coverity warns for not checking return valuev9.0.0628
Problem: Coverity warns for not checking return value. Solution: Check the return value and simplify the code.
Diffstat (limited to 'src/vim9type.c')
-rw-r--r--src/vim9type.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/vim9type.c b/src/vim9type.c
index c4aec7b19a..771fbf54b9 100644
--- a/src/vim9type.c
+++ b/src/vim9type.c
@@ -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;
}