From 5ea2ac36e4eaf1ae3303ada380cad8b4bbcbfe8f Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Fri, 21 Sep 2007 20:45:06 +0000 Subject: Stop crashing when exiting windows. --- window.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'window.c') diff --git a/window.c b/window.c index dc7eec10..5a1e8c22 100644 --- a/window.c +++ b/window.c @@ -1,4 +1,4 @@ -/* $Id: window.c,v 1.9 2007-09-21 18:20:44 nicm Exp $ */ +/* $Id: window.c,v 1.10 2007-09-21 20:45:06 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -181,9 +181,8 @@ window_remove(struct windows *ww, struct window *w) if (window_index(ww, w, &i) != 0) fatalx("window not found"); - if (i != ARRAY_LENGTH(ww) - 1) - ARRAY_SET(ww, i, NULL); - else + ARRAY_SET(ww, i, NULL); + while (!ARRAY_EMPTY(ww) && ARRAY_LAST(ww) == NULL) ARRAY_TRUNC(ww, 1); w->references--; -- cgit