diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-04-15 14:11:10 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-15 14:11:10 +0800 |
commit | 1ca77c222b00215657bae416eba5d280a1d9dc29 (patch) | |
tree | 2d203ebcd6609c1db6c61cde4d43fccb7424f341 /src/nvim/eval.c | |
parent | c2e47e7bec0394a2cc12c8f83e3e5950ad99d1b4 (diff) | |
parent | 85741677c86f7686e3597a310f8059608e7816fb (diff) | |
download | rneovim-1ca77c222b00215657bae416eba5d280a1d9dc29.tar.gz rneovim-1ca77c222b00215657bae416eba5d280a1d9dc29.tar.bz2 rneovim-1ca77c222b00215657bae416eba5d280a1d9dc29.zip |
Merge pull request #23097 from zeertzjq/vim-8.2.0101
vim-patch:8.2.{0101,0102,0103,0104,0633,0634}: null typval tests
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 6a8b24ceed..f555d973e4 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -789,6 +789,9 @@ int eval_expr_typval(const typval_T *expr, typval_T *argv, int argc, typval_T *r } } else if (expr->v_type == VAR_PARTIAL) { partial_T *const partial = expr->vval.v_partial; + if (partial == NULL) { + return FAIL; + } const char *const s = partial_name(partial); if (s == NULL || *s == NUL) { return FAIL; @@ -4056,7 +4059,10 @@ char *partial_name(partial_T *pt) if (pt->pt_name != NULL) { return pt->pt_name; } - return pt->pt_func->uf_name; + if (pt->pt_func != NULL) { + return pt->pt_func->uf_name; + } + return ""; } static void partial_free(partial_T *pt) @@ -8640,8 +8646,9 @@ int typval_compare(typval_T *typ1, typval_T *typ2, exprtype_T type, bool ic) } if ((typ1->v_type == VAR_PARTIAL && typ1->vval.v_partial == NULL) || (typ2->v_type == VAR_PARTIAL && typ2->vval.v_partial == NULL)) { - // when a partial is NULL assume not equal - n1 = false; + // When both partials are NULL, then they are equal. + // Otherwise they are not equal. + n1 = (typ1->vval.v_partial == typ2->vval.v_partial); } else if (type_is) { if (typ1->v_type == VAR_FUNC && typ2->v_type == VAR_FUNC) { // strings are considered the same if their value is |