check if client is not NULL

Debian bug #459992
This commit is contained in:
Julien Danjou 2008-01-10 07:04:51 +01:00
parent 5aa2d4fd1a
commit ce0b433aba
2 changed files with 10 additions and 7 deletions

View File

@ -697,7 +697,7 @@ client_isvisible(Client *c, int screen)
{ {
Tag *tag; Tag *tag;
if(c->screen != screen) if(!c || c->screen != screen)
return False; return False;
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next) for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)

View File

@ -189,12 +189,15 @@ tasklist_button_press(Widget *widget, XButtonPressedEvent *ev)
if(ISVISIBLE_ON_TB(c, widget->statusbar->screen, d->show_all)) if(ISVISIBLE_ON_TB(c, widget->statusbar->screen, d->show_all))
i++; i++;
/* first switch tag if client not visible */ if(c)
if(!client_isvisible(c, widget->statusbar->screen)) {
for(i = 0, tag = globalconf.screens[c->screen].tags; tag; tag = tag->next, i++) /* first switch tag if client not visible */
if(is_client_tagged(c, tag)) if(!client_isvisible(c, widget->statusbar->screen))
tag_view(c->screen, i); for(i = 0, tag = globalconf.screens[c->screen].tags; tag; tag = tag->next, i++)
focus(c, True, widget->statusbar->screen); if(is_client_tagged(c, tag))
tag_view(c->screen, i);
focus(c, True, widget->statusbar->screen);
}
return; return;
} }