Add consistent checks against NULL.

This commit is contained in:
okan 2015-08-27 18:42:56 +00:00
parent 19826222f6
commit f467838e7b
2 changed files with 8 additions and 7 deletions

View File

@ -204,7 +204,7 @@ client_setactive(struct client_ctx *cc)
if (cc->flags & CLIENT_WM_TAKE_FOCUS) if (cc->flags & CLIENT_WM_TAKE_FOCUS)
client_msg(cc, cwmh[WM_TAKE_FOCUS], Last_Event_Time); client_msg(cc, cwmh[WM_TAKE_FOCUS], Last_Event_Time);
if ((oldcc = client_current())) { if ((oldcc = client_current()) != NULL) {
oldcc->flags &= ~CLIENT_ACTIVE; oldcc->flags &= ~CLIENT_ACTIVE;
client_draw_border(oldcc); client_draw_border(oldcc);
} }
@ -707,9 +707,10 @@ client_cycle_leave(struct screen_ctx *sc)
sc->cycling = 0; sc->cycling = 0;
if ((cc = client_current())) { if ((cc = client_current()) != NULL) {
client_mtf(cc); client_mtf(cc);
group_toggle_membership_leave(cc); cc->flags &= ~CLIENT_HIGHLIGHT;
client_draw_border(cc);
XUngrabKeyboard(X_Dpy, CurrentTime); XUngrabKeyboard(X_Dpy, CurrentTime);
} }
} }
@ -914,7 +915,7 @@ client_transient(struct client_ctx *cc)
Window trans; Window trans;
if (XGetTransientForHint(X_Dpy, cc->win, &trans)) { if (XGetTransientForHint(X_Dpy, cc->win, &trans)) {
if ((tc = client_find(trans)) && tc->group) { if ((tc = client_find(trans)) != NULL && tc->group) {
group_movetogroup(cc, tc->group->num); group_movetogroup(cc, tc->group->num);
if (tc->flags & CLIENT_IGNORE) if (tc->flags & CLIENT_IGNORE)
cc->flags |= CLIENT_IGNORE; cc->flags |= CLIENT_IGNORE;

View File

@ -77,7 +77,7 @@ xev_handle_maprequest(XEvent *ee)
XMapRequestEvent *e = &ee->xmaprequest; XMapRequestEvent *e = &ee->xmaprequest;
struct client_ctx *cc = NULL, *old_cc; struct client_ctx *cc = NULL, *old_cc;
if ((old_cc = client_current())) if ((old_cc = client_current()) != NULL)
client_ptrsave(old_cc); client_ptrsave(old_cc);
if ((cc = client_find(e->window)) == NULL) if ((cc = client_find(e->window)) == NULL)
@ -252,7 +252,7 @@ xev_handle_buttonrelease(XEvent *ee)
{ {
struct client_ctx *cc; struct client_ctx *cc;
if ((cc = client_current())) if ((cc = client_current()) != NULL)
group_toggle_membership_leave(cc); group_toggle_membership_leave(cc);
} }
@ -339,7 +339,7 @@ xev_handle_clientmessage(XEvent *ee)
} }
} else if (e->message_type == ewmh[_NET_ACTIVE_WINDOW]) { } else if (e->message_type == ewmh[_NET_ACTIVE_WINDOW]) {
if ((cc = client_find(e->window)) != NULL) { if ((cc = client_find(e->window)) != NULL) {
if ((old_cc = client_current())) if ((old_cc = client_current()) != NULL)
client_ptrsave(old_cc); client_ptrsave(old_cc);
client_ptrwarp(cc); client_ptrwarp(cc);
} }