aboutsummaryrefslogtreecommitdiff
path: root/session.c
diff options
context:
space:
mode:
Diffstat (limited to 'session.c')
-rw-r--r--session.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/session.c b/session.c
index d0ebafac..10a2750a 100644
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
-/* $Id: session.c,v 1.11 2007-09-21 18:31:58 nicm Exp $ */
+/* $Id: session.c,v 1.12 2007-09-21 18:35:16 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -130,16 +130,16 @@ int
session_detach(struct session *s, struct window *w)
{
window_remove(&s->windows, w);
+ if (ARRAY_EMPTY(&s->windows)) {
+ session_destroy(s);
+ return (1);
+ }
if (s->last == w)
s->last = NULL;
if (s->window == w && session_last(s) != 0 && session_previous(s) != 0)
session_next(s);
-
- if (!ARRAY_EMPTY(&s->windows))
- return (0);
- session_destroy(s);
- return (1);
+ return (0);
}
/* Return if session has window. */