File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,11 @@ private void Add()
5353 [ RelayCommand ]
5454 private void Delete ( )
5555 {
56- CustomBrowsers . RemoveAt ( SelectedCustomBrowserIndex -- ) ;
56+ var currentIndex = SelectedCustomBrowserIndex ;
57+ if ( currentIndex >= 0 && currentIndex < CustomBrowsers . Count )
58+ {
59+ CustomBrowsers . RemoveAt ( currentIndex ) ;
60+ SelectedCustomBrowserIndex = currentIndex > 0 ? currentIndex - 1 : 0 ;
61+ }
5762 }
5863}
Original file line number Diff line number Diff line change 33using System . Diagnostics ;
44using System . IO ;
55using System . Linq ;
6- using System . Threading . Tasks ;
76using System . Windows ;
8- using System . Windows . Controls ;
9- using System . Windows . Documents ;
107using CommunityToolkit . Mvvm . Input ;
118using Flow . Launcher . Infrastructure . UserSettings ;
129using Flow . Launcher . Plugin ;
13- using ModernWpf . Controls ;
1410
1511namespace Flow . Launcher . ViewModel ;
1612
@@ -115,6 +111,11 @@ private void Add()
115111 [ RelayCommand ]
116112 private void Delete ( )
117113 {
118- CustomExplorers . RemoveAt ( SelectedCustomExplorerIndex -- ) ;
114+ var currentIndex = SelectedCustomExplorerIndex ;
115+ if ( currentIndex >= 0 && currentIndex < CustomExplorers . Count )
116+ {
117+ CustomExplorers . RemoveAt ( currentIndex ) ;
118+ SelectedCustomExplorerIndex = currentIndex > 0 ? currentIndex - 1 : 0 ;
119+ }
119120 }
120121}
You can’t perform that action at this time.
0 commit comments