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 -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230302173904.27F5A1C0F2A%40moolenaar.net.

Raspunde prin e-mail lui