From e8870d65378452c08ba5f85d0202b347595e6c2a Mon Sep 17 00:00:00 2001 From: patrick96 Date: Wed, 21 Dec 2022 23:47:57 +0100 Subject: [PATCH] tray: Prevent crash when no wallpaper is found --- src/x11/tray_client.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/x11/tray_client.cpp b/src/x11/tray_client.cpp index 8b8c6b75..df64953f 100644 --- a/src/x11/tray_client.cpp +++ b/src/x11/tray_client.cpp @@ -355,9 +355,14 @@ void client::update_bg() const { // Composite background slice with background color. // TODO this doesn't have to be done if the background color is not transparent. m_context->clear(); - *m_context << CAIRO_OPERATOR_SOURCE << *m_bg_slice->get_surface(); - m_context->paint(); - *m_context << CAIRO_OPERATOR_OVER << m_desired_background; + + auto root_bg = m_bg_slice->get_surface(); + if (root_bg != nullptr) { + *m_context << CAIRO_OPERATOR_SOURCE << *root_bg; + m_context->paint(); + *m_context << CAIRO_OPERATOR_OVER; + } + *m_context << m_desired_background; m_context->paint(); m_surface->flush();