mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-11 11:25:57 +03:00
Fix a possible crash on find history build
This commit is contained in:
parent
a881d42a97
commit
e8d548143e
@ -8,6 +8,7 @@ Change Log
|
||||
### Fixes
|
||||
|
||||
- Fix an issue where the syntax highlighting indicator could display twice.
|
||||
- Improve general stability.
|
||||
|
||||
|
||||
|
||||
|
@ -257,9 +257,9 @@ final class FindPanelFieldViewController: NSViewController, NSTextViewDelegate {
|
||||
private func buildHistoryMenu(_ menu: NSMenu, defaultsKey key: DefaultKey<[String]>, action: Selector) {
|
||||
|
||||
// clear current history items
|
||||
for item in menu.items where (item.action == action || item.isSeparatorItem) {
|
||||
menu.removeItem(item)
|
||||
}
|
||||
menu.items
|
||||
.filter { $0.action == action || $0.isSeparatorItem }
|
||||
.forEach { menu.removeItem($0) }
|
||||
|
||||
guard let history = UserDefaults.standard[key], !history.isEmpty else { return }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user