pointermgr: avoid derefing null outputs

This commit is contained in:
Vaxry 2024-09-11 09:30:21 +01:00
parent 155d44016d
commit 518399a95b

View file

@ -675,7 +675,7 @@ void CPointerManager::damageIfSoftware() {
static auto PNOHW = CConfigValue<Hyprlang::INT>("cursor:no_hardware_cursors"); static auto PNOHW = CConfigValue<Hyprlang::INT>("cursor:no_hardware_cursors");
for (auto const& mw : monitorStates) { for (auto const& mw : monitorStates) {
if (mw->monitor.expired()) if (mw->monitor.expired() || !mw->monitor->output)
continue; continue;
if ((mw->softwareLocks > 0 || mw->hardwareFailed || *PNOHW) && b.overlaps({mw->monitor->vecPosition, mw->monitor->vecSize})) { if ((mw->softwareLocks > 0 || mw->hardwareFailed || *PNOHW) && b.overlaps({mw->monitor->vecPosition, mw->monitor->vecSize})) {
@ -789,7 +789,7 @@ void CPointerManager::warpAbsolute(Vector2D abs, SP<IHID> dev) {
void CPointerManager::onMonitorLayoutChange() { void CPointerManager::onMonitorLayoutChange() {
currentMonitorLayout.monitorBoxes.clear(); currentMonitorLayout.monitorBoxes.clear();
for (auto const& m : g_pCompositor->m_vMonitors) { for (auto const& m : g_pCompositor->m_vMonitors) {
if (m->isMirror() || !m->m_bEnabled) if (m->isMirror() || !m->m_bEnabled || !m->output)
continue; continue;
currentMonitorLayout.monitorBoxes.emplace_back(CBox{m->vecPosition, m->vecSize}); currentMonitorLayout.monitorBoxes.emplace_back(CBox{m->vecPosition, m->vecSize});