From 4f48258269c80a99064ff8f5541dbfef32c21c94 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Fri, 31 Mar 2023 01:29:21 +0200 Subject: [PATCH] kscreenintegration: don't access optionals that may be missing a value --- src/kscreenintegration.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kscreenintegration.cpp b/src/kscreenintegration.cpp index 30df8b59b5..baa110dd30 100644 --- a/src/kscreenintegration.cpp +++ b/src/kscreenintegration.cpp @@ -242,14 +242,14 @@ std::optional>> readOutputConfi } bool allDisabled = std::all_of(outputs.begin(), outputs.end(), [&cfg](const auto &output) { - return !cfg.changeSet(output)->enabled; + return !cfg.changeSet(output)->enabled.value_or(output->isEnabled()); }); if (allDisabled) { qCWarning(KWIN_CORE) << "KScreen config would disable all outputs!"; return std::nullopt; } std::erase_if(outputOrder, [&cfg](const auto &pair) { - return !cfg.constChangeSet(pair.second)->enabled; + return !cfg.constChangeSet(pair.second)->enabled.value_or(pair.second->isEnabled()); }); std::sort(outputOrder.begin(), outputOrder.end(), [](const auto &left, const auto &right) { if (left.first == right.first) {