Skip to content

Commit

Permalink
Fixed: crash in token field autocomplete.
Browse files Browse the repository at this point in the history
Without this fix, the autocomplete field would try to select the CPNotFound index from time to time which has always been wrong but is now specifically an error in Cappuccino.

The fix is to select nothing instead.
  • Loading branch information
aljungberg committed Feb 3, 2013
1 parent 49c52a0 commit 0f64616
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions AppKit/_CPAutocompleteMenu.j
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,13 @@ var _CPAutocompleteMenuMaximumHeight = 307;

- (void)setIndexOfSelectedItem:(int)anIndex
{
[tableView selectRowIndexes:[CPIndexSet indexSetWithIndex:anIndex] byExtendingSelection:NO];
[tableView scrollRowToVisible:anIndex];
if (anIndex == CPNotFound)
[tableView selectRowIndexes:[CPIndexSet indexSet] byExtendingSelection:NO];
else
{
[tableView selectRowIndexes:[CPIndexSet indexSetWithIndex:anIndex] byExtendingSelection:NO];
[tableView scrollRowToVisible:anIndex];
}
}

- (int)indexOfSelectedItem
Expand Down

0 comments on commit 0f64616

Please sign in to comment.