1
0
forked from aniani/vim

patch 8.2.5051: check for autocmd_add() event argument is confusing

Problem:    Check for autocmd_add() event argument is confusing.
Solution:   Make the code more straightforward.
This commit is contained in:
Bram Moolenaar
2022-06-01 16:02:38 +01:00
parent 409510c588
commit 882476ad7b
2 changed files with 8 additions and 8 deletions

View File

@@ -2951,26 +2951,24 @@ autocmd_add_or_delete(typval_T *argvars, typval_T *rettv, int delete)
if (eli == NULL) if (eli == NULL)
break; break;
if (eli->li_tv.v_type != VAR_STRING if (eli->li_tv.v_type != VAR_STRING
|| eli->li_tv.vval.v_string == NULL) || (p = eli->li_tv.vval.v_string) == NULL)
{ {
emsg(_(e_string_required)); emsg(_(e_string_required));
continue; break;
} }
p = eli->li_tv.vval.v_string;
} }
else else
{ {
if (end == NULL) if (p == NULL)
p = end = event_name; p = event_name;
if (end == NULL || *end == NUL) if (p == NULL || *p == NUL)
break; break;
} }
if (p == NULL)
continue;
event = event_name2nr(p, &end); event = event_name2nr(p, &end);
if (event == NUM_EVENTS || *end != NUL) if (event == NUM_EVENTS || *end != NUL)
{ {
// this also catches something following a valid event name
semsg(_(e_no_such_event_str), p); semsg(_(e_no_such_event_str), p);
retval = VVAL_FALSE; retval = VVAL_FALSE;
break; break;

View File

@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
5051,
/**/ /**/
5050, 5050,
/**/ /**/