summaryrefslogtreecommitdiffstats
path: root/src/ex_docmd.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-07-08 14:44:50 +0200
committerBram Moolenaar <Bram@vim.org>2017-07-08 14:44:50 +0200
commit0ea5070d79c8a13fb2403280a72f968495b0fab7 (patch)
treeb75f6e705f210716e624e65bcdb07da869784d2b /src/ex_docmd.c
parent710b4a16465fb38492801a0dccf2293397aadc6a (diff)
patch 8.0.0700: segfault with QuitPre autocommand closes the windowv8.0.0700
Problem: Segfault with QuitPre autocommand closes the window. (Marek) Solution: Check that the window pointer is still valid. (Christian Brabandt, closes #1817)
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r--src/ex_docmd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 6ff578e655..8f427cfde0 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -7271,8 +7271,11 @@ ex_quit(exarg_T *eap)
apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf);
/* Refuse to quit when locked or when the buffer in the last window is
* being closed (can only happen in autocommands). */
- if (curbuf_locked() || (wp->w_buffer->b_nwindows == 1
- && wp->w_buffer->b_locked > 0))
+ if (curbuf_locked()
+# ifdef FEAT_WINDOWS
+ || !win_valid(wp)
+# endif
+ || (wp->w_buffer->b_nwindows == 1 && wp->w_buffer->b_locked > 0))
return;
#endif