Mercurial > vim
diff src/dict.c @ 29138:175eacde28b8 v8.2.5089
patch 8.2.5089: some functions return a different value on failure
Commit: https://github.com/vim/vim/commit/ca195cc84fb3f5e497cdbc5f1f53dc1d7efedf48
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Tue Jun 14 13:42:26 2022 +0100
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 14 Jun 2022 14:45:07 +0200 |
parents | 3626ca6a20ea |
children | 827d9f2b7a71 |
line wrap: on
line diff
--- a/src/dict.c +++ b/src/dict.c @@ -1457,6 +1457,9 @@ dict_list(typval_T *argvars, typval_T *r 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 @@ dict_list(typval_T *argvars, typval_T *r return; } - if (rettv_list_alloc(rettv) == FAIL) - return; if ((d = argvars[0].vval.v_dict) == NULL) // empty dict behaves like an empty dict return;