]> git.sur5r.net Git - i3/i3/blobdiff - src/handlers.c
Bugfix: Don’t crash when asprintf() can’t print the window name (Thanks ch3ka)
[i3/i3] / src / handlers.c
index d31d0f33b2b7840335d24039f8e025c5fe6aefc7..0102cb12ac6704747d3f082afafb7716561e881e 100644 (file)
@@ -747,7 +747,11 @@ int handle_windowname_change_legacy(void *data, xcb_connection_t *conn, uint8_t
 
         /* Save the old pointer to make the update atomic */
         char *new_name;
-        asprintf(&new_name, "%.*s", xcb_get_property_value_length(prop), (char*)xcb_get_property_value(prop));
+        if (asprintf(&new_name, "%.*s", xcb_get_property_value_length(prop), (char*)xcb_get_property_value(prop)) == -1) {
+                perror("Could not get old name");
+                LOG("Could not get old name\n");
+                return 1;
+        }
         /* Convert it to UCS-2 here for not having to convert it later every time we want to pass it to X */
         LOG("Name should change to \"%s\"\n", new_name);