0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 9.0.1402: crash when using null_class

Problem:    Crash when using null_class.
Solution:   Give an error when trying to use a null class.
This commit is contained in:
Bram Moolenaar 2023-03-11 20:56:35 +00:00
parent c481ad38f0
commit d13dd30240
3 changed files with 15 additions and 0 deletions

View File

@ -203,6 +203,13 @@ def Test_returning_null_object()
v9.CheckScriptSuccess(lines) v9.CheckScriptSuccess(lines)
enddef enddef
def Test_using_null_class()
var lines =<< trim END
@_ = null_class.member
END
v9.CheckDefExecAndScriptFailure(lines, ['E715:', 'E1363:'])
enddef
def Test_class_interface_wrong_end() def Test_class_interface_wrong_end()
var lines =<< trim END var lines =<< trim END
vim9script vim9script

View File

@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1402,
/**/ /**/
1401, 1401,
/**/ /**/

View File

@ -1262,6 +1262,12 @@ class_object_index(
cl = rettv->vval.v_object->obj_class; cl = rettv->vval.v_object->obj_class;
} }
if (cl == NULL)
{
emsg(_(e_incomplete_type));
return FAIL;
}
if (*name_end == '(') if (*name_end == '(')
{ {
int on_class = rettv->v_type == VAR_CLASS; int on_class = rettv->v_type == VAR_CLASS;