From 6e6c05bd46aa90db0450a62409c8da433e6a7a7a Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sun, 30 Jun 2024 12:23:17 +0200 Subject: [PATCH] fix nullptr deref --- src/helpers/Monitor.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index bb9ae17f..f4b06071 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -790,9 +790,12 @@ bool CMonitorState::test() { bool CMonitorState::updateSwapchain() { auto options = m_pOwner->output->swapchain->currentOptions(); const auto& STATE = m_pOwner->output->state->state(); + const auto& MODE = STATE.mode ? STATE.mode : STATE.customMode; + if (!MODE) + return true; options.format = STATE.drmFormat; options.scanout = true; options.length = 2; - options.size = STATE.mode ? STATE.mode->pixelSize : STATE.customMode->pixelSize; + options.size = MODE->pixelSize; return m_pOwner->output->swapchain->reconfigure(options); }