fix nullptr deref

This commit is contained in:
Vaxry 2024-06-30 12:23:17 +02:00
parent 972e4241d9
commit 6e6c05bd46

View file

@ -790,9 +790,12 @@ bool CMonitorState::test() {
bool CMonitorState::updateSwapchain() { bool CMonitorState::updateSwapchain() {
auto options = m_pOwner->output->swapchain->currentOptions(); auto options = m_pOwner->output->swapchain->currentOptions();
const auto& STATE = m_pOwner->output->state->state(); 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.format = STATE.drmFormat;
options.scanout = true; options.scanout = true;
options.length = 2; options.length = 2;
options.size = STATE.mode ? STATE.mode->pixelSize : STATE.customMode->pixelSize; options.size = MODE->pixelSize;
return m_pOwner->output->swapchain->reconfigure(options); return m_pOwner->output->swapchain->reconfigure(options);
} }