wayland/outputmanagement: don't access nullptr changesets

Since 6b8e08dfa9, changesets can be nullptr
This commit is contained in:
Xaver Hugl 2023-03-30 17:30:06 +02:00 committed by Vlad Zahorodnii
parent 101e38527d
commit 66495f9c79

View file

@ -266,7 +266,12 @@ void OutputConfigurationV2Interface::kde_output_configuration_v2_apply(Resource
const auto allOutputs = kwinApp()->outputBackend()->outputs();
const bool allDisabled = !std::any_of(allOutputs.begin(), allOutputs.end(), [this](const auto &output) {
return config.constChangeSet(output)->enabled;
const auto changeset = config.constChangeSet(output);
if (changeset && changeset->enabled.has_value()) {
return *changeset->enabled;
} else {
return output->isEnabled();
}
});
if (allDisabled) {
qCWarning(KWIN_CORE) << "Disabling all outputs through configuration changes is not allowed";
@ -285,7 +290,12 @@ void OutputConfigurationV2Interface::kde_output_configuration_v2_apply(Resource
return;
}
outputOrder.erase(std::remove_if(outputOrder.begin(), outputOrder.end(), [this](const auto &pair) {
return !config.constChangeSet(pair.second->handle())->enabled;
const auto changeset = config.constChangeSet(pair.second->handle());
if (changeset && changeset->enabled.has_value()) {
return *changeset->enabled;
} else {
return pair.second->handle()->isEnabled();
}
}),
outputOrder.end());
std::sort(outputOrder.begin(), outputOrder.end(), [](const auto &pair1, const auto &pair2) {