]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1411: crash when calling non-existing function for tabpanel v9.1.1411
authorChristian Brabandt <cb@256bit.org>
Mon, 26 May 2025 17:51:03 +0000 (19:51 +0200)
committerChristian Brabandt <cb@256bit.org>
Mon, 26 May 2025 17:51:03 +0000 (19:51 +0200)
Problem:  crash when calling non-existing function for tabpanel (Yamagi,
          after v9.1.1391)
Solution: check if there was an error and if there was, set tabpanel
          option to empty to prevent showing errors on every redraw

fixes: #17364
closes: #17375
closes: #17371

Signed-off-by: Christian Brabandt <cb@256bit.org>
src/tabpanel.c
src/testdir/test_tabpanel.vim
src/version.c

index 81e2c0c079bddd6cf87fe866e009632dc4540d4f..bb7a8742b2ca335033efce5f338d7cff6b646aa0 100644 (file)
@@ -496,6 +496,7 @@ starts_with_percent_and_bang(tabpanel_T *pargs)
 {
     int                len = 0;
     char_u     *usefmt = p_tpl;
+    int                did_emsg_before = did_emsg;
 
     if (usefmt == NULL)
        return NULL;
@@ -525,6 +526,13 @@ starts_with_percent_and_bang(tabpanel_T *pargs)
            usefmt = p;
 
        do_unlet((char_u *)"g:tabpanel_winid", TRUE);
+
+       if (did_emsg > did_emsg_before)
+       {
+           usefmt = NULL;
+           set_string_option_direct((char_u *)"tabpanel", -1, (char_u *)"",
+                   OPT_FREE | OPT_GLOBAL, SID_ERROR);
+       }
     }
 #endif
 
index c67166e1cb810457407003e146dc483376223461..6aaae63ac3bf48c98083a4c70a32b17f93991110 100644 (file)
@@ -521,4 +521,16 @@ function Test_tabpanel_equalalways()
   call StopVimInTerminal(buf)
 endfunc
 
+function Test_tabpanel_error()
+  set tabpanel=%!NonExistingFunc()
+  try
+    set showtabpanel=2
+    redraw!
+  catch /^Vim\%((\a\+)\)\=:E117:/
+  endtry
+  call assert_true(empty(&tabpanel))
+  set tabpanel&vim
+  set showtabpanel&vim
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 33b08bb3aaf72a823f5162ffa94b5dc43538c2d8..67ac9fbfcb74dc632fa91078f89b43b27daba38a 100644 (file)
@@ -709,6 +709,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1411,
 /**/
     1410,
 /**/