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()
53
53
[ RelayCommand ]
54
54
private void Delete ( )
55
55
{
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
+ }
57
62
}
58
63
}
Original file line number Diff line number Diff line change 3
3
using System . Diagnostics ;
4
4
using System . IO ;
5
5
using System . Linq ;
6
- using System . Threading . Tasks ;
7
6
using System . Windows ;
8
- using System . Windows . Controls ;
9
- using System . Windows . Documents ;
10
7
using CommunityToolkit . Mvvm . Input ;
11
8
using Flow . Launcher . Infrastructure . UserSettings ;
12
9
using Flow . Launcher . Plugin ;
13
- using ModernWpf . Controls ;
14
10
15
11
namespace Flow . Launcher . ViewModel ;
16
12
@@ -115,6 +111,11 @@ private void Add()
115
111
[ RelayCommand ]
116
112
private void Delete ( )
117
113
{
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
+ }
119
120
}
120
121
}
You can’t perform that action at this time.
0 commit comments