0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.3382: crash when getting the type of a NULL partial

Problem:    Crash when getting the type of a NULL partial.
Solution:   Check for NULL. (closes #8260)
This commit is contained in:
Bram Moolenaar
2021-08-28 14:58:44 +02:00
parent 5c56da4de8
commit c8103b4c25
3 changed files with 14 additions and 2 deletions

View File

@@ -327,7 +327,7 @@ typval2type_int(typval_T *tv, int copyID, garray_T *type_gap, int do_member)
char_u *name = NULL;
ufunc_T *ufunc = NULL;
if (tv->v_type == VAR_PARTIAL)
if (tv->v_type == VAR_PARTIAL && tv->vval.v_partial != NULL)
{
if (tv->vval.v_partial->pt_func != NULL)
ufunc = tv->vval.v_partial->pt_func;
@@ -382,7 +382,8 @@ typval2type_int(typval_T *tv, int copyID, garray_T *type_gap, int do_member)
type->tt_type = tv->v_type;
type->tt_argcount = argcount;
type->tt_min_argcount = min_argcount;
if (tv->v_type == VAR_PARTIAL && tv->vval.v_partial->pt_argc > 0)
if (tv->v_type == VAR_PARTIAL && tv->vval.v_partial != NULL
&& tv->vval.v_partial->pt_argc > 0)
{
type->tt_argcount -= tv->vval.v_partial->pt_argc;
type->tt_min_argcount -= tv->vval.v_partial->pt_argc;