diff options
-rw-r--r-- | src/testdir/test_vim9_class.vim | 4 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim9class.c | 3 |
3 files changed, 9 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim index fa621b25ac..1021114a9d 100644 --- a/src/testdir/test_vim9_class.vim +++ b/src/testdir/test_vim9_class.vim @@ -3032,6 +3032,10 @@ def Test_instanceof() assert_true(instanceof(a3, [Base1, Base2, Intf1])) enddef Foo() + + var o_null: Base1 + assert_false(instanceof(o_null, Base1)) + END v9.CheckSourceSuccess(lines) enddef diff --git a/src/version.c b/src/version.c index c2bef2ff57..79b1e11c70 100644 --- a/src/version.c +++ b/src/version.c @@ -700,6 +700,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1911, +/**/ 1910, /**/ 1909, diff --git a/src/vim9class.c b/src/vim9class.c index da862f2667..f122f90c1f 100644 --- a/src/vim9class.c +++ b/src/vim9class.c @@ -2865,6 +2865,9 @@ f_instanceof(typval_T *argvars, typval_T *rettv) || check_for_class_or_list_arg(argvars, 1) == FAIL) return; + if (object_tv->vval.v_object == NULL) + return; + if (classinfo_tv->v_type == VAR_LIST) { FOR_ALL_LIST_ITEMS(classinfo_tv->vval.v_list, li) |