diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs index 3e7c3cb8361..2ec69e81a5f 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs @@ -89,9 +89,12 @@ private void CustomHotkeyEdit() if (window.ShowDialog() is not true) return; var index = Settings.CustomPluginHotkeys.IndexOf(settingItem); - Settings.CustomPluginHotkeys[index] = new CustomPluginHotkey(window.Hotkey, window.ActionKeyword); - HotKeyMapper.RemoveHotkey(settingItem.Hotkey); // remove origin hotkey - HotKeyMapper.SetCustomQueryHotkey(Settings.CustomPluginHotkeys[index]); // set new hotkey + if (index >= 0 && index < Settings.CustomPluginHotkeys.Count) + { + Settings.CustomPluginHotkeys[index] = new CustomPluginHotkey(window.Hotkey, window.ActionKeyword); + HotKeyMapper.RemoveHotkey(settingItem.Hotkey); // remove origin hotkey + HotKeyMapper.SetCustomQueryHotkey(Settings.CustomPluginHotkeys[index]); // set new hotkey + } } [RelayCommand] @@ -150,7 +153,10 @@ private void CustomShortcutEdit() if (window.ShowDialog() is not true) return; var index = Settings.CustomShortcuts.IndexOf(settingItem); - Settings.CustomShortcuts[index] = new CustomShortcutModel(window.Key, window.Value); + if (index >= 0 && index < Settings.CustomShortcuts.Count) + { + Settings.CustomShortcuts[index] = new CustomShortcutModel(window.Key, window.Value); + } } [RelayCommand] diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.WebSearch/Languages/en.xaml index c6a74a0470a..5d65e4462dd 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/Languages/en.xaml @@ -47,6 +47,7 @@ Please enter a URL Action keyword already exists, please enter a different one Success + Failed to update search source. The item may have been removed. Hint: You do not need to place custom images in this directory, if Flow's version is updated they will be lost. Flow will automatically copy any images outside of this directory across to WebSearch's custom image location. Web Searches diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs index acc2c1e5c2c..9508d61a0cf 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs @@ -108,9 +108,19 @@ private void EditSearchSource() _context.API.AddActionKeyword(id, newKeyword); var index = _searchSources.IndexOf(_oldSearchSource); - _searchSources[index] = _searchSource; - - Close(); + + // Only update if we found the item in the collection + if (index >= 0 && index < _searchSources.Count) + { + _searchSources[index] = _searchSource; + Close(); + } + else + { + var warning = _api.GetTranslation("flowlauncher_plugin_websearch_edit_failed"); + _context.API.ShowMsgBox(warning); + Close(); + } } else {