From: Michael Stapelberg Date: Fri, 19 Jun 2009 09:05:00 +0000 (+0200) Subject: Bugfix: Don’t crash when programs set NULL hints (xev(1) for example) X-Git-Tag: 3.b~51 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a2a8cd85d6db9315e36c50eab52d1b8073d2aecb;p=i3%2Fi3 Bugfix: Don’t crash when programs set NULL hints (xev(1) for example) This only happened if you had some assignment configured --- diff --git a/src/client.c b/src/client.c index 53cacbf4..a7a6e3e8 100644 --- a/src/client.c +++ b/src/client.c @@ -115,7 +115,7 @@ void client_kill(xcb_connection_t *conn, Client *window) { bool client_matches_class_name(Client *client, char *to_class, char *to_title, char *to_title_ucs, int to_title_ucs_len) { /* Check if the given class is part of the window class */ - if (strcasestr(client->window_class, to_class) == NULL) + if (client->window_class == NULL || strcasestr(client->window_class, to_class) == NULL) return false; /* If no title was given, we’re done */ @@ -124,11 +124,11 @@ bool client_matches_class_name(Client *client, char *to_class, char *to_title, if (client->name_len > -1) { /* UCS-2 converted window titles */ - if (memmem(client->name, (client->name_len * 2), to_title_ucs, (to_title_ucs_len * 2)) == NULL) + if (client->name == NULL || memmem(client->name, (client->name_len * 2), to_title_ucs, (to_title_ucs_len * 2)) == NULL) return false; } else { /* Legacy hints */ - if (strcasestr(client->name, to_title) == NULL) + if (client->name == NULL || strcasestr(client->name, to_title) == NULL) return false; }