To: vim_dev@googlegroups.com Subject: Patch 9.0.1370 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1370 Problem: Crash when using a NULL object. (Ernie Rael) Solution: Check for NULL and give an error message. (closes #12083) Files: src/vim9execute.c, src/testdir/test_vim9_class.vim *** ../vim-9.0.1369/src/vim9execute.c 2023-02-27 08:07:10.877872837 +0000 --- src/vim9execute.c 2023-03-02 17:33:26.827353741 +0000 *************** *** 5321,5326 **** --- 5321,5333 ---- } object_T *obj = tv->vval.v_object; + if (obj == NULL) + { + SOURCING_LNUM = iptr->isn_lnum; + emsg(_(e_using_null_object)); + goto on_error; + } + int idx; if (iptr->isn_type == ISN_GET_OBJ_MEMBER) idx = iptr->isn_arg.number; *** ../vim-9.0.1369/src/testdir/test_vim9_class.vim 2023-02-26 18:58:19.754802188 +0000 --- src/testdir/test_vim9_class.vim 2023-03-02 17:36:28.059552954 +0000 *************** *** 238,243 **** --- 238,261 ---- 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 *** ../vim-9.0.1369/src/version.c 2023-03-02 14:46:43.889086014 +0000 --- src/version.c 2023-03-02 17:34:29.247408434 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1370, /**/ -- hundred-and-one symptoms of being an internet addict: 210. When you get a divorce, you don't care about who gets the children, but discuss endlessly who can use the email address. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///