Skip to content

Commit 3a59968

Browse files
Jack251970TBM13
authored andcommitted
Fix ArgumentOutOfRangeException in WebSearch Plugin (Flow-Launcher#4041)
1 parent 0a05305 commit 3a59968

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff 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]

0 commit comments

Comments
 (0)