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>
diff --git a/src/tabpanel.c b/src/tabpanel.c
index 81e2c0c..bb7a874 100644
--- a/src/tabpanel.c
+++ b/src/tabpanel.c
@@ -496,6 +496,7 @@
{
int len = 0;
char_u *usefmt = p_tpl;
+ int did_emsg_before = did_emsg;
if (usefmt == NULL)
return NULL;
@@ -525,6 +526,13 @@
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