From 8a5f9bbb394ddeb4be9a9df6248b41b07d84ea66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Wed, 31 Jul 2024 16:54:07 +0100 Subject: [PATCH] keybinds: handle null monitor in pinActive (#7122) --- src/managers/KeybindManager.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 2b99ce97..823e2d2e 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -2333,8 +2333,16 @@ void CKeybindManager::pinActive(std::string args) { if (!PWINDOW->m_bIsFloating || PWINDOW->m_bIsFullscreen) return; - PWINDOW->m_bPinned = !PWINDOW->m_bPinned; - PWINDOW->m_pWorkspace = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID)->activeWorkspace; + PWINDOW->m_bPinned = !PWINDOW->m_bPinned; + + const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID); + + if (!PMONITOR) { + Debug::log(ERR, "pin: monitor not found"); + return; + } + + PWINDOW->m_pWorkspace = PMONITOR->activeWorkspace; PWINDOW->updateDynamicRules(); g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW);