effects/kwinquickeffect: ensure view map doesn't contain a nullptr view

BUG: 462014
This commit is contained in:
Xaver Hugl 2022-11-19 13:48:01 +01:00
parent bd7a6bb65d
commit cf3b167d50

View file

@ -208,10 +208,13 @@ QuickSceneView *QuickSceneEffect::viewAt(const QPoint &pos) const
QuickSceneView *QuickSceneEffect::activeView() const QuickSceneView *QuickSceneEffect::activeView() const
{ {
const auto it = std::find_if(d->views.begin(), d->views.end(), [](const auto &view) { auto it = std::find_if(d->views.begin(), d->views.end(), [](const auto &view) {
return view.second->window()->activeFocusItem(); return view.second->window()->activeFocusItem();
}); });
return it == d->views.end() ? d->views[effects->activeScreen()].get() : it->second.get(); if (it == d->views.end()) {
it = d->views.find(effects->activeScreen());
}
return it == d->views.end() ? nullptr : it->second.get();
} }
KWin::QuickSceneView *QuickSceneEffect::getView(Qt::Edge edge) KWin::QuickSceneView *QuickSceneEffect::getView(Qt::Edge edge)