]> git.mdlowis.com Git - proto/labwc.git/commitdiff
src/osd.c: prevent crash with theme setting osd.window-switcher.width: 0
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Sun, 27 Aug 2023 19:11:04 +0000 (21:11 +0200)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Sun, 27 Aug 2023 19:25:32 +0000 (21:25 +0200)
Fixes: #1050
Reported-by: @4ffy (thanks)
src/osd.c

index ba52536c1edcabea4bebfa3cf35630739d50c261..5477cf27e842cff332666cc100b257e0a2b6b39c 100644 (file)
--- a/src/osd.c
+++ b/src/osd.c
@@ -425,6 +425,10 @@ display_osd(struct output *output)
                wlr_buffer_drop(&output->osd_buffer->base);
        }
        output->osd_buffer = buffer_create_cairo(w, h, scale, true);
+       if (!output->osd_buffer) {
+               wlr_log(WLR_ERROR, "Failed to allocate cairo buffer for the window switcher");
+               return;
+       }
 
        /* Render OSD image */
        cairo_t *cairo = output->osd_buffer->cairo;
@@ -462,7 +466,7 @@ osd_update(struct server *server)
                return;
        }
 
-       if (rc.window_switcher.show) {
+       if (rc.window_switcher.show && rc.theme->osd_window_switcher_width > 0) {
                /* Display the actual OSD */
                struct output *output;
                wl_list_for_each(output, &server->outputs, link) {