module/i3: don't try to strdup() a NULL pointer

This commit is contained in:
Daniel Eklöf 2019-02-20 18:21:58 +01:00
parent fe709bd82b
commit cd28099ad8

View file

@ -368,7 +368,9 @@ handle_window_event(int type, const struct json_object *json, void *_mod)
} }
free(ws->window.title); 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); ws->window.id = json_object_get_int(id);
/* If PID has changed, update application name from /proc/<pid>/comm */ /* If PID has changed, update application name from /proc/<pid>/comm */