summaryrefslogtreecommitdiff
path: root/src/scriptfile.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-07-08 15:16:19 +0200
committerBram Moolenaar <Bram@vim.org>2020-07-08 15:16:19 +0200
commitc620c055ce8505596a7208ba696a32b8a3be4f4b (patch)
treed61c203d6df6363f0466c4b4b8f4bd14141926c0 /src/scriptfile.c
parentbed36b939a4c66f41d1f24e32cfa521b10f22b82 (diff)
downloadvim-git-c620c055ce8505596a7208ba696a32b8a3be4f4b.tar.gz
patch 8.2.1154: Vim9: crash when using imported functionv8.2.1154
Problem: Vim9: crash when using imported function. Solution: Check for a function type. Set the script context when calling a function. (closes #6412)
Diffstat (limited to 'src/scriptfile.c')
-rw-r--r--src/scriptfile.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/scriptfile.c b/src/scriptfile.c
index 9ffc66c1b..ce4bafada 100644
--- a/src/scriptfile.c
+++ b/src/scriptfile.c
@@ -68,7 +68,7 @@ estack_push(etype_T type, char_u *name, long lnum)
/*
* Add a user function to the execution stack.
*/
- void
+ estack_T *
estack_push_ufunc(ufunc_T *ufunc, long lnum)
{
estack_T *entry = estack_push(ETYPE_UFUNC,
@@ -76,6 +76,7 @@ estack_push_ufunc(ufunc_T *ufunc, long lnum)
? ufunc->uf_name_exp : ufunc->uf_name, lnum);
if (entry != NULL)
entry->es_info.ufunc = ufunc;
+ return entry;
}
/*
@@ -97,13 +98,15 @@ estack_top_is_ufunc(ufunc_T *ufunc, long lnum)
#endif
/*
- * Take an item off of the execution stack.
+ * Take an item off of the execution stack and return it.
*/
- void
+ estack_T *
estack_pop(void)
{
- if (exestack.ga_len > 1)
- --exestack.ga_len;
+ if (exestack.ga_len == 0)
+ return NULL;
+ --exestack.ga_len;
+ return ((estack_T *)exestack.ga_data) + exestack.ga_len;
}
/*