From a2a8cd85d6db9315e36c50eab52d1b8073d2aecb Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Fri, 19 Jun 2009 11:05:00 +0200 Subject: [PATCH] =?UTF-8?q?Bugfix:=20Don=E2=80=99t=20crash=20when=20progra?= =?UTF-8?q?ms=20set=20NULL=20hints=20(xev(1)=20for=20example)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This only happened if you had some assignment configured --- src/client.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; }