patch 8.2.0097: crash with autocommand and spellfile
Problem: Crash with autocommand and spellfile. (Tim Pope)
Solution: Do not pop exestack when not pushed. (closes #5450)
diff --git a/src/spellfile.c b/src/spellfile.c
index 6cad202..fa450f3 100644
--- a/src/spellfile.c
+++ b/src/spellfile.c
@@ -352,6 +352,7 @@
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 @@
// 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 @@
endOK:
if (fd != NULL)
fclose(fd);
- estack_pop();
+ if (did_estack_push)
+ estack_pop();
return lp;
}