diff --git a/src/app/components/all_photos.rs b/src/app/components/all_photos.rs index 50305adc..6fc55bcb 100644 --- a/src/app/components/all_photos.rs +++ b/src/app/components/all_photos.rs @@ -142,7 +142,9 @@ impl SimpleComponent for AllPhotos { let pictures_box = &model.pictures_grid_view.view; - pictures_box.scroll_to(model.pictures_grid_view.len(), gtk::ListScrollFlags::SELECT, None); + if !model.pictures_grid_view.is_empty(){ + pictures_box.scroll_to(model.pictures_grid_view.len() - 1, gtk::ListScrollFlags::SELECT, None); + } let widgets = view_output!(); ComponentParts { model, widgets } diff --git a/src/app/components/month_photos.rs b/src/app/components/month_photos.rs index 8e925af9..fe876232 100644 --- a/src/app/components/month_photos.rs +++ b/src/app/components/month_photos.rs @@ -158,7 +158,9 @@ impl SimpleComponent for MonthPhotos { }; let pictures_box = &model.pictures_grid_view.view; - pictures_box.scroll_to(model.pictures_grid_view.len(), gtk::ListScrollFlags::SELECT, None); + if !model.pictures_grid_view.is_empty(){ + pictures_box.scroll_to(model.pictures_grid_view.len() - 1, gtk::ListScrollFlags::SELECT, None); + } let widgets = view_output!(); ComponentParts { model, widgets } diff --git a/src/app/components/year_photos.rs b/src/app/components/year_photos.rs index cf6453a7..391d65e2 100644 --- a/src/app/components/year_photos.rs +++ b/src/app/components/year_photos.rs @@ -152,7 +152,9 @@ impl SimpleComponent for YearPhotos { }; let pictures_box = &model.pictures_grid_view.view; - pictures_box.scroll_to(model.pictures_grid_view.len(), gtk::ListScrollFlags::SELECT, None); + if !model.pictures_grid_view.is_empty(){ + pictures_box.scroll_to(model.pictures_grid_view.len() - 1, gtk::ListScrollFlags::SELECT, None); + } let widgets = view_output!(); ComponentParts { model, widgets }