patch 9.0.1370: crash when using a NULL object
Problem: Crash when using a NULL object. (Ernie Rael)
Solution: Check for NULL and give an error message. (closes #12083)
diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim
index 3bb289b..c228f26 100644
--- a/src/testdir/test_vim9_class.vim
+++ b/src/testdir/test_vim9_class.vim
@@ -238,6 +238,24 @@
lines =<< trim END
vim9script
+ class Class
+ this.id: string
+ def Method1()
+ echo 'Method1' .. this.id
+ enddef
+ endclass
+
+ var obj: Class
+ def Func()
+ obj.Method1()
+ enddef
+ Func()
+ END
+ v9.CheckScriptFailure(lines, 'E1360:')
+
+ lines =<< trim END
+ vim9script
+
class Background
this.background = 'dark'
endclass