window: avoid nullptr deref on monitor in box helpers

fixes #6321
This commit is contained in:
Vaxry 2024-06-03 21:09:18 +02:00
parent 3fd6c1b30e
commit b30c7125d7

View file

@ -176,9 +176,11 @@ CBox CWindow::getFullWindowBoundingBox() {
}
CBox CWindow::getWindowIdealBoundingBoxIgnoreReserved() {
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
if (!PMONITOR)
return {m_vPosition, m_vSize};
auto POS = m_vPosition;
auto SIZE = m_vSize;
@ -208,9 +210,9 @@ CBox CWindow::getWindowIdealBoundingBoxIgnoreReserved() {
}
CBox CWindow::getWindowBoxUnified(uint64_t properties) {
if (m_sAdditionalConfigData.dimAround) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
if (PMONITOR)
return {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y};
}