sway/sway_text_node: fix cairo_create() error checking

As per the manual, this function cannot return NULL
This commit is contained in:
Félix Poisot 2026-03-20 19:09:49 +00:00
parent f8ab16c57a
commit cfea88ed5f

View file

@ -107,8 +107,10 @@ static void render_backing_buffer(struct text_buffer *buffer) {
} }
cairo_t *cairo = cairo_create(surface); cairo_t *cairo = cairo_create(surface);
if (!cairo) { status = cairo_status(cairo);
sway_log(SWAY_ERROR, "cairo_create failed"); if (status != CAIRO_STATUS_SUCCESS) {
sway_log(SWAY_ERROR, "cairo_create() failed: %s",
cairo_status_to_string(status));
free(cairo_buffer); free(cairo_buffer);
goto err; goto err;
} }
@ -200,8 +202,10 @@ static void text_calc_size(struct text_buffer *buffer) {
cairo_surface_t *dummy_surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1, 1); cairo_surface_t *dummy_surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1, 1);
cairo_t *c = cairo_create(dummy_surface); cairo_t *c = cairo_create(dummy_surface);
if (!c) { cairo_status_t status = cairo_status(c);
sway_log(SWAY_ERROR, "cairo_t allocation failed"); if (status != CAIRO_STATUS_SUCCESS) {
sway_log(SWAY_ERROR, "cairo_create() failed: %s",
cairo_status_to_string(status));
return; return;
} }