mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-04 15:05:36 +00:00
Ameliorates against a potential NSRangeException.
This commit is contained in:
parent
a7aeb779e9
commit
2c71ba0744
@ -51,7 +51,11 @@ class MachinePicker: NSObject {
|
|||||||
|
|
||||||
// Machine type
|
// Machine type
|
||||||
if let machineIdentifier = standardUserDefaults.string(forKey: "new.machine") {
|
if let machineIdentifier = standardUserDefaults.string(forKey: "new.machine") {
|
||||||
machineSelector?.selectTabViewItem(withIdentifier: machineIdentifier as Any)
|
// If I've changed my mind about visible tabs between versions, there may not be one that corresponds
|
||||||
|
// to the stored identifier. Make sure not to raise an NSRangeException in that scenario.
|
||||||
|
if let index = machineSelector?.indexOfTabViewItem(withIdentifier: machineIdentifier as Any), index != NSNotFound {
|
||||||
|
machineSelector?.selectTabViewItem(at: index)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apple II settings
|
// Apple II settings
|
||||||
|
Loading…
Reference in New Issue
Block a user