DisplayProperties: Do not assert on trying to select unset wallpaper

When wallpapers are not present in WindowServer.ini, don't try
to select them in the wallpapers list.
This commit is contained in:
Tibor Nagy 2020-02-26 15:54:55 +01:00 committed by Andreas Kling
parent 4e394862ce
commit 712e7102b0
Notes: sideshowbarker 2024-07-19 09:03:01 +09:00

View file

@ -138,10 +138,11 @@ void DisplayPropertiesWidget::create_frame()
auto wallpaper_model = wallpaper_list->model();
auto find_first_wallpaper_index = m_wallpapers.find_first_index(m_selected_wallpaper);
ASSERT(find_first_wallpaper_index.has_value());
auto wallpaper_index_in_model = wallpaper_model->index(find_first_wallpaper_index.value(), wallpaper_list->model_column());
if (wallpaper_model->is_valid(wallpaper_index_in_model))
wallpaper_list->selection().set(wallpaper_index_in_model);
if (find_first_wallpaper_index.has_value()) {
auto wallpaper_index_in_model = wallpaper_model->index(find_first_wallpaper_index.value(), wallpaper_list->model_column());
if (wallpaper_model->is_valid(wallpaper_index_in_model))
wallpaper_list->selection().set(wallpaper_index_in_model);
}
wallpaper_list->horizontal_scrollbar().set_visible(false);
wallpaper_list->on_selection = [this](auto& index) {