From 22bbffa1aea498ab10c919551867a34be6343772 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sat, 16 Jul 2022 22:51:18 +0200 Subject: [PATCH] fix crash with empty buffers --- src/Hyprpaper.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Hyprpaper.cpp b/src/Hyprpaper.cpp index c660857..c94cf15 100644 --- a/src/Hyprpaper.cpp +++ b/src/Hyprpaper.cpp @@ -317,7 +317,19 @@ void CHyprpaper::renderWallpaperForMonitor(SMonitor* pMonitor) { exit(1); } - auto *const PBUFFER = getPoolBuffer(pMonitor, PWALLPAPERTARGET); + auto* PBUFFER = getPoolBuffer(pMonitor, PWALLPAPERTARGET); + + if (!PBUFFER) { + Debug::log(LOG, "Pool buffer missing for available target??"); + ensurePoolBuffersPresent(); + + PBUFFER = getPoolBuffer(pMonitor, PWALLPAPERTARGET); + + if (!PBUFFER) { + Debug::log(LOG, "Pool buffer failed #2. Ignoring WP."); + return; + } + } const auto PCAIRO = PBUFFER->cairo; cairo_save(PCAIRO);