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 #12005)
Handle error from calling a user function better.
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 49042a4..4bbed82 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -1283,7 +1283,7 @@
{
typval_T argvars[MAX_FUNC_ARGS];
funcexe_T funcexe;
- int error;
+ funcerror_T error;
int idx;
int did_emsg_before = did_emsg;
compiletype_T compile_type = get_compile_type(ufunc);
@@ -1464,10 +1464,10 @@
name = tv->vval.v_string;
if (name != NULL)
{
- char_u fname_buf[FLEN_FIXED + 1];
- char_u *tofree = NULL;
- int error = FCERR_NONE;
- char_u *fname;
+ char_u fname_buf[FLEN_FIXED + 1];
+ char_u *tofree = NULL;
+ funcerror_T error = FCERR_NONE;
+ char_u *fname;
// May need to translate <SNR>123_ to K_SNR.
fname = fname_trans_sid(name, fname_buf, &tofree, &error);