From 01296eb62fc6256945737a3f46631040be7996b7 Mon Sep 17 00:00:00 2001 From: Dominique Pelle Date: Sat, 12 Jun 2021 12:11:23 +0200 Subject: [PATCH] Fixed crash when doing :call test_null_function()() --- src/testdir/test_functions.vim | 5 +++++ src/userfunc.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim index 1309554395316..6be3602a824b4 100644 --- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -2179,6 +2179,11 @@ func Test_call() call call(test_null_partial(), []) endfunc +func Test_test_null_function() + " This once caused a crash. + call test_null_function()() +endfunc + func Test_char2nr() call assert_equal(12354, char2nr('あ', 1)) call assert_equal(120, 'x'->char2nr()) diff --git a/src/userfunc.c b/src/userfunc.c index 64e815d04207c..dd7f2ca289e91 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -3099,6 +3099,9 @@ call_func( // even when call_func() returns FAIL. rettv->v_type = VAR_UNKNOWN; + if (funcname == NULL) + return ret; + if (partial != NULL) fp = partial->pt_func; if (fp == NULL)