comparison 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
comparison
equal deleted inserted replaced
25691:1c6f93ee1ed5 25692:17830c066d4b
325 if (tv->v_type == VAR_FUNC || tv->v_type == VAR_PARTIAL) 325 if (tv->v_type == VAR_FUNC || tv->v_type == VAR_PARTIAL)
326 { 326 {
327 char_u *name = NULL; 327 char_u *name = NULL;
328 ufunc_T *ufunc = NULL; 328 ufunc_T *ufunc = NULL;
329 329
330 if (tv->v_type == VAR_PARTIAL) 330 if (tv->v_type == VAR_PARTIAL && tv->vval.v_partial != NULL)
331 { 331 {
332 if (tv->vval.v_partial->pt_func != NULL) 332 if (tv->vval.v_partial->pt_func != NULL)
333 ufunc = tv->vval.v_partial->pt_func; 333 ufunc = tv->vval.v_partial->pt_func;
334 else 334 else
335 name = tv->vval.v_partial->pt_name; 335 name = tv->vval.v_partial->pt_name;
380 if (type == NULL) 380 if (type == NULL)
381 return NULL; 381 return NULL;
382 type->tt_type = tv->v_type; 382 type->tt_type = tv->v_type;
383 type->tt_argcount = argcount; 383 type->tt_argcount = argcount;
384 type->tt_min_argcount = min_argcount; 384 type->tt_min_argcount = min_argcount;
385 if (tv->v_type == VAR_PARTIAL && tv->vval.v_partial->pt_argc > 0) 385 if (tv->v_type == VAR_PARTIAL && tv->vval.v_partial != NULL
386 && tv->vval.v_partial->pt_argc > 0)
386 { 387 {
387 type->tt_argcount -= tv->vval.v_partial->pt_argc; 388 type->tt_argcount -= tv->vval.v_partial->pt_argc;
388 type->tt_min_argcount -= tv->vval.v_partial->pt_argc; 389 type->tt_min_argcount -= tv->vval.v_partial->pt_argc;
389 } 390 }
390 type->tt_member = member_type; 391 type->tt_member = member_type;