Deal more gracefully with absent choices

This commit is contained in:
Matthias Neeracher 2015-12-24 03:05:15 +01:00 committed by Matthias Neeracher
parent b7628c8c65
commit ccba71cc2e

View File

@ -111,7 +111,7 @@ class ASHardware {
if choices.count <= 10 { if choices.count <= 10 {
menu.addSortedChoices([ASPropertyEntry](choices.values), target: target, selector: selector) menu.addSortedChoices([ASPropertyEntry](choices.values), target: target, selector: selector)
} else { } else {
menu.addSortedChoices(recentChoices.map({ (recent: String) in choices[recent]! }), target: target, selector: selector) menu.addSortedChoices(recentChoices.flatMap({ (recent: String) in choices[recent] }), target: target, selector: selector)
menu.addItem(NSMenuItem.separatorItem()) menu.addItem(NSMenuItem.separatorItem())
var seen = [String: Bool]() var seen = [String: Bool]()
for prop in choices.values { for prop in choices.values {