Permalink
Browse files

Fixed: crash in token field autocomplete.

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...
1 parent 49c52a0 commit 0f6461602e0d00286683066b7f344ecc51200bd6 @aljungberg aljungberg committed Feb 3, 2013
Showing with 7 additions and 2 deletions.
  1. +7 −2 AppKit/_CPAutocompleteMenu.j
@@ -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

0 comments on commit 0f64616

Please sign in to comment.