Patch 8.2.0361
Problem:    Internal error when using "0" for a callback.
Solution:   Give a normal error. (closes #5743)
Files:      src/evalvars.c, src/testdir/test_timers.vim


*** ../vim-8.2.0360/src/evalvars.c      2020-02-26 20:15:14.944051070 +0100
--- src/evalvars.c      2020-03-07 16:54:34.690751040 +0100
***************
*** 3643,3649 ****
      callback_T
  get_callback(typval_T *arg)
  {
!     callback_T res;
  
      res.cb_free_name = FALSE;
      if (arg->v_type == VAR_PARTIAL && arg->vval.v_partial != NULL)
--- 3643,3650 ----
      callback_T
  get_callback(typval_T *arg)
  {
!     callback_T  res;
!     int               r = OK;
  
      res.cb_free_name = FALSE;
      if (arg->v_type == VAR_PARTIAL && arg->vval.v_partial != NULL)
***************
*** 3655,3671 ****
      else
      {
        res.cb_partial = NULL;
!       if (arg->v_type == VAR_FUNC || arg->v_type == VAR_STRING)
        {
            // Note that we don't make a copy of the string.
            res.cb_name = arg->vval.v_string;
            func_ref(res.cb_name);
        }
        else if (arg->v_type == VAR_NUMBER && arg->vval.v_number == 0)
-       {
            res.cb_name = (char_u *)"";
-       }
        else
        {
            emsg(_("E921: Invalid callback argument"));
            res.cb_name = NULL;
--- 3656,3676 ----
      else
      {
        res.cb_partial = NULL;
!       if (arg->v_type == VAR_STRING && arg->vval.v_string != NULL
!                                              && isdigit(*arg->vval.v_string))
!           r = FAIL;
!       else if (arg->v_type == VAR_FUNC || arg->v_type == VAR_STRING)
        {
            // Note that we don't make a copy of the string.
            res.cb_name = arg->vval.v_string;
            func_ref(res.cb_name);
        }
        else if (arg->v_type == VAR_NUMBER && arg->vval.v_number == 0)
            res.cb_name = (char_u *)"";
        else
+           r = FAIL;
+ 
+       if (r == FAIL)
        {
            emsg(_("E921: Invalid callback argument"));
            res.cb_name = NULL;
*** ../vim-8.2.0360/src/testdir/test_timers.vim 2020-02-03 21:40:00.005363654 
+0100
--- src/testdir/test_timers.vim 2020-03-07 16:57:00.702109064 +0100
***************
*** 422,425 ****
--- 422,429 ----
    call timer_stop(timer)
  endfunc
  
+ func Test_timer_invalid_callback()
+   call assert_fails('call timer_start(0, "0")', 'E921')
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.0360/src/version.c       2020-03-06 22:25:52.500279411 +0100
--- src/version.c       2020-03-07 16:45:54.081041889 +0100
***************
*** 740,741 ****
--- 740,743 ----
  {   /* Add new patch number below this line */
+ /**/
+     361,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
186. You overstay in the office so you can have more time surfing the net.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            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/202003071600.027G0Til025880%40masaka.moolenaar.net.

Raspunde prin e-mail lui