From cd28099ad838d8ddef59034979bdef8aea462ceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Wed, 20 Feb 2019 18:21:58 +0100 Subject: [PATCH] module/i3: don't try to strdup() a NULL pointer --- modules/i3.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/i3.c b/modules/i3.c index d7210e7..b451783 100644 --- a/modules/i3.c +++ b/modules/i3.c @@ -368,7 +368,9 @@ handle_window_event(int type, const struct json_object *json, void *_mod) } free(ws->window.title); - ws->window.title = strdup(json_object_get_string(name)); + + const char *title = json_object_get_string(name); + ws->window.title = title != NULL ? strdup(title) : NULL; ws->window.id = json_object_get_int(id); /* If PID has changed, update application name from /proc//comm */