File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Flow.Launcher/SettingPages/ViewModels Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -79,9 +79,12 @@ private void CustomHotkeyEdit()
7979 if ( window . ShowDialog ( ) is not true ) return ;
8080
8181 var index = Settings . CustomPluginHotkeys . IndexOf ( settingItem ) ;
82- Settings . CustomPluginHotkeys [ index ] = new CustomPluginHotkey ( window . Hotkey , window . ActionKeyword ) ;
83- HotKeyMapper . RemoveHotkey ( settingItem . Hotkey ) ; // remove origin hotkey
84- HotKeyMapper . SetCustomQueryHotkey ( Settings . CustomPluginHotkeys [ index ] ) ; // set new hotkey
82+ if ( index >= 0 && index < Settings . CustomPluginHotkeys . Count )
83+ {
84+ Settings . CustomPluginHotkeys [ index ] = new CustomPluginHotkey ( window . Hotkey , window . ActionKeyword ) ;
85+ HotKeyMapper . RemoveHotkey ( settingItem . Hotkey ) ; // remove origin hotkey
86+ HotKeyMapper . SetCustomQueryHotkey ( Settings . CustomPluginHotkeys [ index ] ) ; // set new hotkey
87+ }
8588 }
8689
8790 [ RelayCommand ]
@@ -140,7 +143,10 @@ private void CustomShortcutEdit()
140143 if ( window . ShowDialog ( ) is not true ) return ;
141144
142145 var index = Settings . CustomShortcuts . IndexOf ( settingItem ) ;
143- Settings . CustomShortcuts [ index ] = new CustomShortcutModel ( window . Key , window . Value ) ;
146+ if ( index >= 0 && index < Settings . CustomShortcuts . Count )
147+ {
148+ Settings . CustomShortcuts [ index ] = new CustomShortcutModel ( window . Key , window . Value ) ;
149+ }
144150 }
145151
146152 [ RelayCommand ]
You can’t perform that action at this time.
0 commit comments