mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-01-12 01:30:03 +00:00
Cope with invalid keyboard ids
This commit is contained in:
parent
14a5fd6aaf
commit
415c2721bc
@ -298,10 +298,8 @@ extern string UserPrefsPath; // from prefs_unix.cpp
|
|||||||
- (IBAction) ChangeKeyboard: (NSPopUpButton *)sender
|
- (IBAction) ChangeKeyboard: (NSPopUpButton *)sender
|
||||||
{
|
{
|
||||||
// Deselest current item
|
// Deselest current item
|
||||||
int val = PrefsFindInt32("keyboardtype");
|
int current = [keyboard indexOfItemWithTag: PrefsFindInt32("keyboardtype")];
|
||||||
int current = [keyboard indexOfItemWithTag: val];
|
if ( current != -1 )
|
||||||
|
|
||||||
if ( current )
|
|
||||||
[[keyboard itemAtIndex: current] setState: FALSE];
|
[[keyboard itemAtIndex: current] setState: FALSE];
|
||||||
|
|
||||||
PrefsReplaceInt32("keyboardtype", [[sender selectedItem] tag]);
|
PrefsReplaceInt32("keyboardtype", [[sender selectedItem] tag]);
|
||||||
@ -774,7 +772,9 @@ shouldProceedAfterError: (NSDictionary *) errorDict
|
|||||||
// Lists of thingies:
|
// Lists of thingies:
|
||||||
|
|
||||||
val = PrefsFindInt32("keyboardtype");
|
val = PrefsFindInt32("keyboardtype");
|
||||||
[keyboard selectItemAtIndex: [keyboard indexOfItemWithTag: val]];
|
tmp = [keyboard indexOfItemWithTag: val];
|
||||||
|
if ( tmp != -1 )
|
||||||
|
[keyboard selectItemAtIndex: tmp];
|
||||||
for ( tmp = 0; tmp < [keyboard numberOfItems]; ++tmp )
|
for ( tmp = 0; tmp < [keyboard numberOfItems]; ++tmp )
|
||||||
{
|
{
|
||||||
NSMenuItem *type = [keyboard itemAtIndex: tmp];
|
NSMenuItem *type = [keyboard itemAtIndex: tmp];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user