From ce0b433aba662cb938d64bd433b2f770c61d88a4 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 10 Jan 2008 07:04:51 +0100 Subject: [PATCH] check if client is not NULL Debian bug #459992 --- client.c | 2 +- widgets/tasklist.c | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/client.c b/client.c index 3f6e5c31..f8607dd6 100644 --- a/client.c +++ b/client.c @@ -697,7 +697,7 @@ client_isvisible(Client *c, int screen) { Tag *tag; - if(c->screen != screen) + if(!c || c->screen != screen) return False; for(tag = globalconf.screens[screen].tags; tag; tag = tag->next) diff --git a/widgets/tasklist.c b/widgets/tasklist.c index 7fe5b5a5..dd4bc384 100644 --- a/widgets/tasklist.c +++ b/widgets/tasklist.c @@ -189,12 +189,15 @@ tasklist_button_press(Widget *widget, XButtonPressedEvent *ev) if(ISVISIBLE_ON_TB(c, widget->statusbar->screen, d->show_all)) i++; - /* first switch tag if client not visible */ - if(!client_isvisible(c, widget->statusbar->screen)) - for(i = 0, tag = globalconf.screens[c->screen].tags; tag; tag = tag->next, i++) - if(is_client_tagged(c, tag)) - tag_view(c->screen, i); - focus(c, True, widget->statusbar->screen); + if(c) + { + /* first switch tag if client not visible */ + if(!client_isvisible(c, widget->statusbar->screen)) + for(i = 0, tag = globalconf.screens[c->screen].tags; tag; tag = tag->next, i++) + if(is_client_tagged(c, tag)) + tag_view(c->screen, i); + focus(c, True, widget->statusbar->screen); + } return; }