diff --git a/ChangeLog b/ChangeLog index d3309cb0e..5558d94af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-10-30 Matt Rice + + * Source/NSComboBoxCell.m (validateSelection): Test for invalid row. + 2006-10-28 Adam Fedor * Source/NSApplication.m (initialize_gnustep_backend): Use diff --git a/Source/NSComboBoxCell.m b/Source/NSComboBoxCell.m index 4b3d1f3b0..60a94dd4b 100644 --- a/Source/NSComboBoxCell.m +++ b/Source/NSComboBoxCell.m @@ -697,21 +697,25 @@ static GSComboWindow *gsWindow = nil; { NSText *textObject = nil; id cv = [_cell controlView]; + int index = [_cell indexOfSelectedItem]; if ([cv isKindOfClass: [NSControl class]]) { textObject = [(NSControl *)cv currentEditor]; } - [_cell setStringValue: [_cell _stringValueAtIndex: - [_cell indexOfSelectedItem]]]; - // Will update the editor when needed + if (index != -1) + { + [_cell setStringValue: [_cell _stringValueAtIndex: + [_cell indexOfSelectedItem]]]; + // Will update the editor when needed - // FIXME: Because NSCell doesn't behave correctly the line just over has - // no effect, to correct this fact, the code below is needed. - [textObject setString: [_cell _stringValueAtIndex: - [_cell indexOfSelectedItem]]]; - // End of the code to remove + // FIXME: Because NSCell doesn't behave correctly the line just over has + // no effect, to correct this fact, the code below is needed. + [textObject setString: [_cell _stringValueAtIndex: + [_cell indexOfSelectedItem]]]; + // End of the code to remove + } if (textObject != nil) {