summaryrefslogtreecommitdiff
path: root/src/eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-04-24 22:47:31 +0200
committerBram Moolenaar <Bram@vim.org>2020-04-24 22:47:31 +0200
commit9d8d0b5c644ea53364d04403740b3f23e57c1497 (patch)
tree615f9b058821039f8ae1c2cba3f3837500ecc42b /src/eval.c
parent92c461ef1b3b58c7dd4835bc881769f0f84e8ad0 (diff)
downloadvim-git-9d8d0b5c644ea53364d04403740b3f23e57c1497.tar.gz
patch 8.2.0633: crash when using null partial in filter()v8.2.0633
Problem: Crash when using null partial in filter(). Solution: Fix crash. Add more tests. (Yegappan Lakshmanan, closes #5976)
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/eval.c b/src/eval.c
index 260ce96f1..659588f1d 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -241,6 +241,9 @@ eval_expr_typval(typval_T *expr, typval_T *argv, int argc, typval_T *rettv)
{
partial_T *partial = expr->vval.v_partial;
+ if (partial == NULL)
+ return FAIL;
+
if (partial->pt_func != NULL && partial->pt_func->uf_dfunc_idx >= 0)
{
if (call_def_function(partial->pt_func, argc, argv, rettv) == FAIL)
@@ -6416,8 +6419,9 @@ typval_compare(
&& 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)