summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/window.c b/src/window.c
index 95515b57d..408c4bd22 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2445,6 +2445,10 @@ win_close(win, free_buf)
if (win_valid(win))
win->w_closing = FALSE;
#endif
+ /* Make sure curbuf is valid. It can become invalid if 'bufhidden' is
+ * "wipe". */
+ if (!buf_valid(curbuf))
+ curbuf = firstbuf;
}
if (only_one_window() && win_valid(win) && win->w_buffer == NULL