diff --git a/client.c b/client.c index 3f6e5c313..f8607dd6f 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 7fe5b5a54..dd4bc3840 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; }