Patch 8.2.3382
Problem: Crash when getting the type of a NULL partial.
Solution: Check for NULL. (closes #8260)
Files: src/vim9type.c, src/testdir/test_vim9_builtin.vim
*** ../vim-8.2.3381/src/vim9type.c 2021-08-19 21:08:26.178565751 +0200
--- src/vim9type.c 2021-08-28 14:53:40.246105061 +0200
***************
*** 327,333 ****
char_u *name = NULL;
ufunc_T *ufunc = NULL;
! if (tv->v_type == VAR_PARTIAL)
{
if (tv->vval.v_partial->pt_func != NULL)
ufunc = tv->vval.v_partial->pt_func;
--- 327,333 ----
char_u *name = NULL;
ufunc_T *ufunc = NULL;
! 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,388 ****
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)
{
type->tt_argcount -= tv->vval.v_partial->pt_argc;
type->tt_min_argcount -= tv->vval.v_partial->pt_argc;
--- 382,389 ----
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 != 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;
*** ../vim-8.2.3381/src/testdir/test_vim9_builtin.vim 2021-08-21 17:13:08.569405922 +0200
--- src/testdir/test_vim9_builtin.vim 2021-08-28 14:57:29.694122706 +0200
***************
*** 3679,3684 ****
--- 3679,3693 ----
if has('float')
assert_equal('func([unknown], [unknown]): float', typename(function('pow')))
endif
+ assert_equal('func', test_null_partial()->typename())
+ assert_equal('list<unknown>', test_null_list()->typename())
+ assert_equal('dict<unknown>', test_null_dict()->typename())
+ if has('job')
+ assert_equal('job', test_null_job()->typename())
+ endif
+ if has('channel')
+ assert_equal('channel', test_null_channel()->typename())
+ endif
enddef
def Test_undofile()
*** ../vim-8.2.3381/src/version.c 2021-08-28 14:42:20.044971678 +0200
--- src/version.c 2021-08-28 14:58:21.710081435 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3382,
/**/
--
Looking at Perl through Lisp glasses, Perl looks atrocious.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///