userfunc: abort early on invalid refs

Cherry-pick set_ref_in_call_stack() changes from patch 8.1.1575.
This commit is contained in:
Jan Edmund Lazo
2020-09-27 00:02:47 -04:00
parent 594a69579f
commit 9bac43b1fb

View File

@@ -3413,12 +3413,13 @@ bool set_ref_in_call_stack(int copyID)
{ {
bool abort = false; bool abort = false;
for (funccall_T *fc = current_funccal; fc != NULL; fc = fc->caller) { for (funccall_T *fc = current_funccal; !abort && fc != NULL;
fc = fc->caller) {
abort = abort || set_ref_in_funccal(fc, copyID); abort = abort || set_ref_in_funccal(fc, copyID);
} }
// Also go through the funccal_stack. // Also go through the funccal_stack.
for (funccal_entry_T *entry = funccal_stack; entry != NULL; for (funccal_entry_T *entry = funccal_stack; !abort && entry != NULL;
entry = entry->next) { entry = entry->next) {
for (funccall_T *fc = entry->top_funccal; !abort && fc != NULL; for (funccall_T *fc = entry->top_funccal; !abort && fc != NULL;
fc = fc->caller) { fc = fc->caller) {