From a26b40fa28d7731318faf9aac568ea45fb5fbbee Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 5 Feb 2008 07:15:23 +0100 Subject: [PATCH] fix segfault in client_zoom --- client.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/client.c b/client.c index 0370440df..2c2c2e388 100644 --- a/client.c +++ b/client.c @@ -1002,17 +1002,20 @@ uicb_client_zoom(int screen, char *arg __attribute__ ((unused))) { Client *c, *sel = globalconf.focus->client; + if(!sel) + return; + for(c = globalconf.clients; !client_isvisible(c, screen); c = c->next); if(c == sel) for(sel = sel->next; sel && !client_isvisible(sel, screen); sel = sel->next); - if(!sel) - return; - - client_list_detach(&globalconf.clients, sel); - client_list_push(&globalconf.clients, sel); - globalconf.screens[screen].need_arrange = True; - globalconf.drop_events |= EnterWindowMask; + if(sel) + { + client_list_detach(&globalconf.clients, sel); + client_list_push(&globalconf.clients, sel); + globalconf.screens[screen].need_arrange = True; + globalconf.drop_events |= EnterWindowMask; + } } /** Send focus to next client in stack