Skip to content
Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
brammool committed Mar 11, 2023
1 parent c481ad3 commit d13dd30
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/testdir/test_vim9_class.vim
Expand Up @@ -203,6 +203,13 @@ def Test_returning_null_object()
v9.CheckScriptSuccess(lines)
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()
var lines =<< trim END
vim9script
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -695,6 +695,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1402,
/**/
1401,
/**/
Expand Down
6 changes: 6 additions & 0 deletions src/vim9class.c
Expand Up @@ -1262,6 +1262,12 @@ class_object_index(
cl = rettv->vval.v_object->obj_class;
}

if (cl == NULL)
{
emsg(_(e_incomplete_type));
return FAIL;
}

if (*name_end == '(')
{
int on_class = rettv->v_type == VAR_CLASS;
Expand Down

0 comments on commit d13dd30

Please sign in to comment.