Skip to content

Commit a88c5bd

Browse files
committed
patch 9.1.1411: crash when calling non-existing function for tabpanel
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>
1 parent 7c62105 commit a88c5bd

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

src/tabpanel.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ starts_with_percent_and_bang(tabpanel_T *pargs)
496496
{
497497
int len = 0;
498498
char_u *usefmt = p_tpl;
499+
int did_emsg_before = did_emsg;
499500

500501
if (usefmt == NULL)
501502
return NULL;
@@ -525,6 +526,13 @@ starts_with_percent_and_bang(tabpanel_T *pargs)
525526
usefmt = p;
526527

527528
do_unlet((char_u *)"g:tabpanel_winid", TRUE);
529+
530+
if (did_emsg > did_emsg_before)
531+
{
532+
usefmt = NULL;
533+
set_string_option_direct((char_u *)"tabpanel", -1, (char_u *)"",
534+
OPT_FREE | OPT_GLOBAL, SID_ERROR);
535+
}
528536
}
529537
#endif
530538

src/testdir/test_tabpanel.vim

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,4 +521,16 @@ function Test_tabpanel_equalalways()
521521
call StopVimInTerminal(buf)
522522
endfunc
523523

524+
function Test_tabpanel_error()
525+
set tabpanel=%!NonExistingFunc()
526+
try
527+
set showtabpanel=2
528+
redraw!
529+
catch /^Vim\%((\a\+)\)\=:E117:/
530+
endtry
531+
call assert_true(empty(&tabpanel))
532+
set tabpanel&vim
533+
set showtabpanel&vim
534+
endfunc
535+
524536
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,8 @@ static char *(features[]) =
709709

710710
static int included_patches[] =
711711
{ /* Add new patch number below this line */
712+
/**/
713+
1411,
712714
/**/
713715
1410,
714716
/**/

0 commit comments

Comments
 (0)