patch 8.2.5089: some functions return a different value on failure
Problem: Some functions return a different value on failure.
Solution: Initialize the return value earlier. (Yegappan Lakshmanan,
closes #10568)
diff --git a/src/autocmd.c b/src/autocmd.c
index 71aeb50..841da14 100644
--- a/src/autocmd.c
+++ b/src/autocmd.c
@@ -3062,6 +3062,8 @@
char_u *name = NULL;
int group = AUGROUP_ALL;
+ if (rettv_list_alloc(rettv) == FAIL)
+ return;
if (check_for_opt_dict_arg(argvars, 0) == FAIL)
return;
@@ -3128,8 +3130,6 @@
}
}
- if (rettv_list_alloc(rettv) == FAIL)
- return;
event_list = rettv->vval.v_list;
// iterate through all the autocmd events