summaryrefslogtreecommitdiff
path: root/src/spellfile.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-01-07 20:11:42 +0100
committerBram Moolenaar <Bram@vim.org>2020-01-07 20:11:42 +0100
commitce6db0273f2c4359f48d75103a42991aa481f14e (patch)
tree1cb0e8a9563a92d4a92ff9ae0f00b0b6998e6c27 /src/spellfile.c
parentfbcdf671f08cd2c7e60f35574231df0421112d99 (diff)
downloadvim-git-ce6db0273f2c4359f48d75103a42991aa481f14e.tar.gz
patch 8.2.0097: crash with autocommand and spellfilev8.2.0097
Problem: Crash with autocommand and spellfile. (Tim Pope) Solution: Do not pop exestack when not pushed. (closes #5450)
Diffstat (limited to 'src/spellfile.c')
-rw-r--r--src/spellfile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/spellfile.c b/src/spellfile.c
index 6cad202fd..fa450f33d 100644
--- a/src/spellfile.c
+++ b/src/spellfile.c
@@ -352,6 +352,7 @@ spell_load_file(
slang_T *lp = NULL;
int c = 0;
int res;
+ int did_estack_push = FALSE;
fd = mch_fopen((char *)fname, "r");
if (fd == NULL)
@@ -392,6 +393,7 @@ spell_load_file(
// Set sourcing_name, so that error messages mention the file name.
estack_push(ETYPE_SPELL, fname, 0);
+ did_estack_push = TRUE;
/*
* <HEADER>: <fileID>
@@ -578,7 +580,8 @@ endFAIL:
endOK:
if (fd != NULL)
fclose(fd);
- estack_pop();
+ if (did_estack_push)
+ estack_pop();
return lp;
}