Problem: Crash when using a NULL object. (Ernie Rael)
Solution: Check for NULL and give an error message. (closes #12083)
END
v9.CheckScriptFailure(lines, 'E1360:')
+ lines =<< trim END
+ vim9script
+
+ class Class
+ this.id: string
+ def Method1()
+ echo 'Method1' .. this.id
+ enddef
+ endclass
+
+ var obj: Class
+ def Func()
+ obj.Method1()
+ enddef
+ Func()
+ END
+ v9.CheckScriptFailure(lines, 'E1360:')
+
lines =<< trim END
vim9script
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1370,
/**/
1369,
/**/
}
object_T *obj = tv->vval.v_object;
+ if (obj == NULL)
+ {
+ SOURCING_LNUM = iptr->isn_lnum;
+ emsg(_(e_using_null_object));
+ goto on_error;
+ }
+
int idx;
if (iptr->isn_type == ISN_GET_OBJ_MEMBER)
idx = iptr->isn_arg.number;