layout: avoid nullptr deref (#11831)

OPENINGON can be a nullptr and that makes FLOATEDINTOTILED to nullptr
deref and segfault.
This commit is contained in:
Tom Englund 2025-09-25 15:30:04 +02:00 committed by GitHub
parent 8cce3b98ce
commit 5212099b9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -206,7 +206,7 @@ bool IHyprLayout::onWindowCreatedAutoGroup(PHLWINDOW pWindow) {
const PHLWINDOW OPENINGON = g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_workspace == pWindow->m_workspace ?
g_pCompositor->m_lastWindow.lock() :
(pWindow->m_workspace ? pWindow->m_workspace->getFirstWindow() : nullptr);
const bool FLOATEDINTOTILED = pWindow->m_isFloating && !OPENINGON->m_isFloating;
const bool FLOATEDINTOTILED = pWindow->m_isFloating && OPENINGON && !OPENINGON->m_isFloating;
const bool SWALLOWING = pWindow->m_swallowed || pWindow->m_groupSwallowed;
if ((*PAUTOGROUP || SWALLOWING) // continue if auto_group is enabled or if dealing with window swallowing.