diff options
author | vaxerski <[email protected]> | 2023-03-16 14:03:40 +0000 |
---|---|---|
committer | vaxerski <[email protected]> | 2023-03-16 14:03:40 +0000 |
commit | 5d44ea802a604edfcc822c9f2376bb3881f3e805 (patch) | |
tree | d7100204861d272e83f099937c855ef8d6c7e029 | |
parent | d9d57ce39ac25fd8bbfe88ec9d3bccb1e2df8650 (diff) | |
download | Hyprland-5d44ea802a604edfcc822c9f2376bb3881f3e805.tar.gz Hyprland-5d44ea802a604edfcc822c9f2376bb3881f3e805.zip |
monitors: guard output when read
-rw-r--r-- | src/Compositor.cpp | 3 | ||||
-rw-r--r-- | src/config/ConfigManager.cpp | 6 | ||||
-rw-r--r-- | src/managers/KeybindManager.cpp | 3 |
3 files changed, 12 insertions, 0 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 0c3e480f..d2d84f9d 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -1836,6 +1836,9 @@ CMonitor* CCompositor::getMonitorFromString(const std::string& name) { const auto DESCRIPTION = name.substr(5); for (auto& m : m_vMonitors) { + if (!m->output) + continue; + if (m->output->description && std::string(m->output->description).find(DESCRIPTION) == 0) { return m.get(); } diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index c0f2d5c1..4cfd89b6 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -1761,6 +1761,9 @@ bool CConfigManager::shouldBlurLS(const std::string& ns) { void CConfigManager::ensureDPMS() { for (auto& rm : g_pCompositor->m_vRealMonitors) { + if (!rm->output) + continue; + auto rule = getMonitorRuleFor(rm->szName, rm->output->description ? rm->output->description : ""); if (rule.disabled == rm->m_bEnabled) { @@ -1774,6 +1777,9 @@ void CConfigManager::ensureVRR(CMonitor* pMonitor) { static auto* const PVRR = &getConfigValuePtr("misc:vrr")->intValue; static auto ensureVRRForDisplay = [&](CMonitor* m) -> void { + if (!m->output) + return; + if (*PVRR == 0) { if (m->vrrActive) { wlr_output_enable_adaptive_sync(m->output, 0); diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 9d652932..3b0a6678 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -1661,6 +1661,9 @@ void CKeybindManager::forceRendererReload(std::string args) { bool overAgain = false; for (auto& m : g_pCompositor->m_vMonitors) { + if (!m->output) + continue; + auto rule = g_pConfigManager->getMonitorRuleFor(m->szName, m->output->description ? m->output->description : ""); if (!g_pHyprRenderer->applyMonitorRule(m.get(), &rule, true)) { overAgain = true; |