keybinds: handle null monitor in pinActive (#7122)

This commit is contained in:
André Silva 2024-07-31 16:54:07 +01:00 committed by GitHub
parent 3b9b5346b8
commit 8a5f9bbb39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2334,7 +2334,15 @@ void CKeybindManager::pinActive(std::string args) {
return; return;
PWINDOW->m_bPinned = !PWINDOW->m_bPinned; PWINDOW->m_bPinned = !PWINDOW->m_bPinned;
PWINDOW->m_pWorkspace = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID)->activeWorkspace;
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(); PWINDOW->updateDynamicRules();
g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW); g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW);