Mercurial > vim
diff src/vim9type.c @ 25692:17830c066d4b v8.2.3382
patch 8.2.3382: crash when getting the type of a NULL partial
Commit: https://github.com/vim/vim/commit/c8103b4c2547ce2044469bcd49e3d55907bd33d1
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 28 14:58:44 2021 +0200
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 https://github.com/vim/vim/issues/8260)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 28 Aug 2021 15:00:03 +0200 |
parents | 99fbffe75217 |
children | b2c00659152a |
line wrap: on
line diff
--- a/src/vim9type.c +++ b/src/vim9type.c @@ -327,7 +327,7 @@ typval2type_int(typval_T *tv, int copyID 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 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;