0
0
mirror of https://github.com/vim/vim.git synced 2025-10-03 05:14:07 -04:00

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.
This commit is contained in:
Bram Moolenaar
2023-02-18 14:42:44 +00:00
parent 9de960ace0
commit 0917e86763
10 changed files with 94 additions and 48 deletions

View File

@@ -195,6 +195,26 @@ def Test_object_not_set()
echo db[state.value]
END
v9.CheckScriptFailure(lines, 'E1360:')
lines =<< trim END
vim9script
class Background
this.background = 'dark'
endclass
class Colorscheme
this._bg: Background
def GetBackground(): string
return this._bg.background
enddef
endclass
var bg: Background # UNINITIALIZED
echo Colorscheme.new(bg).GetBackground()
END
v9.CheckScriptFailure(lines, 'E1012: Type mismatch; expected object<Background> but got object<Unknown>')
enddef
def Test_class_member_initializer()