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/dict.c b/src/dict.c
index 538dd8b..d281957 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -1457,6 +1457,9 @@
dict_T *d;
int todo;
+ if (rettv_list_alloc(rettv) == FAIL)
+ return;
+
if (in_vim9script() && check_for_dict_arg(argvars, 0) == FAIL)
return;
@@ -1466,8 +1469,6 @@
return;
}
- if (rettv_list_alloc(rettv) == FAIL)
- return;
if ((d = argvars[0].vval.v_dict) == NULL)
// empty dict behaves like an empty dict
return;