updated for version 7.4.251
Problem: Crash when BufAdd autocommand wipes out the buffer.
Solution: Check for buffer to still be valid. Postpone freeing the buffer
structure. (Hirohito Higashi)
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 7ae4917..ac30f2c 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -3343,6 +3343,12 @@
#endif
buf = buflist_new(ffname, sfname, 0L,
BLN_CURBUF | ((flags & ECMD_SET_HELP) ? 0 : BLN_LISTED));
+#ifdef FEAT_AUTOCMD
+ /* autocommands may change curwin and curbuf */
+ if (oldwin != NULL)
+ oldwin = curwin;
+ old_curbuf = curbuf;
+#endif
}
if (buf == NULL)
goto theend;