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:
@@ -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()
|
||||
|
Reference in New Issue
Block a user