comparison src/vim9execute.c @ 31976:16025ef158bf v9.0.1320

patch 9.0.1320: checking the type of a null object causes a crash Commit: https://github.com/vim/vim/commit/0917e867632199883c07c2d7534f7091b1d12607 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Feb 18 14:42:44 2023 +0000 patch 9.0.1320: checking the type of a null object causes a crash Problem: Checking the type of a null object causes a crash. Solution: Don't try to get the class of a null object. (closes https://github.com/vim/vim/issues/12005) Handle error from calling a user function better.
author Bram Moolenaar <Bram@vim.org>
date Sat, 18 Feb 2023 15:45:04 +0100
parents 7b1cbb43506c
children 13329cb9faee
comparison
equal deleted inserted replaced
31975:eed95e0f92ff 31976:16025ef158bf
1281 isn_T *iptr, 1281 isn_T *iptr,
1282 dict_T *selfdict) 1282 dict_T *selfdict)
1283 { 1283 {
1284 typval_T argvars[MAX_FUNC_ARGS]; 1284 typval_T argvars[MAX_FUNC_ARGS];
1285 funcexe_T funcexe; 1285 funcexe_T funcexe;
1286 int error; 1286 funcerror_T error;
1287 int idx; 1287 int idx;
1288 int did_emsg_before = did_emsg; 1288 int did_emsg_before = did_emsg;
1289 compiletype_T compile_type = get_compile_type(ufunc); 1289 compiletype_T compile_type = get_compile_type(ufunc);
1290 1290
1291 if (func_needs_compiling(ufunc, compile_type) 1291 if (func_needs_compiling(ufunc, compile_type)
1462 } 1462 }
1463 else if (tv->v_type == VAR_FUNC) 1463 else if (tv->v_type == VAR_FUNC)
1464 name = tv->vval.v_string; 1464 name = tv->vval.v_string;
1465 if (name != NULL) 1465 if (name != NULL)
1466 { 1466 {
1467 char_u fname_buf[FLEN_FIXED + 1]; 1467 char_u fname_buf[FLEN_FIXED + 1];
1468 char_u *tofree = NULL; 1468 char_u *tofree = NULL;
1469 int error = FCERR_NONE; 1469 funcerror_T error = FCERR_NONE;
1470 char_u *fname; 1470 char_u *fname;
1471 1471
1472 // May need to translate <SNR>123_ to K_SNR. 1472 // May need to translate <SNR>123_ to K_SNR.
1473 fname = fname_trans_sid(name, fname_buf, &tofree, &error); 1473 fname = fname_trans_sid(name, fname_buf, &tofree, &error);
1474 if (error != FCERR_NONE) 1474 if (error != FCERR_NONE)
1475 res = FAIL; 1475 res = FAIL;