diff options
author | rowanbeentje <rowan@beent.je> | 2013-08-25 22:32:28 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2013-08-25 22:32:28 +0000 |
commit | 0e522d9bd52a2b1be6295ee5e196ffece4b9ae6c (patch) | |
tree | 58f70a9a55fa0f680810e74f639cf0a288518459 | |
parent | 2655303d64ebe428e3b321224eb5976de7e79db3 (diff) | |
download | sequelpro-0e522d9bd52a2b1be6295ee5e196ffece4b9ae6c.tar.gz sequelpro-0e522d9bd52a2b1be6295ee5e196ffece4b9ae6c.tar.bz2 sequelpro-0e522d9bd52a2b1be6295ee5e196ffece4b9ae6c.zip |
- Fix an exception on 10.6 when clicking below the table list rows (http://spbug.com/l/1726)
-rw-r--r-- | Source/SPTablesList.m | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m index db3890ff..3abde17d 100644 --- a/Source/SPTablesList.m +++ b/Source/SPTablesList.m @@ -1709,18 +1709,29 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; - (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(NSInteger)rowIndex { // Disallow selection while the document is working on a task - if ([tableDocumentInstance isWorking]) return NO; + if ([tableDocumentInstance isWorking]) { + return NO; + } // Allow deselections - if (rowIndex == -1) return YES; + if (rowIndex == -1) { + return YES; + } + + // On 10.6, right-clicking below all rows attempts to select a high row index + if (rowIndex >= (NSInteger)[filteredTables count]) { + return NO; + } - if(![[filteredTables objectAtIndex:rowIndex] isKindOfClass:[NSString class]]) + if (![[filteredTables objectAtIndex:rowIndex] isKindOfClass:[NSString class]]) { return NO; + } - //return (rowIndex != 0); - if( [filteredTableTypes count] == 0 ) + if ([filteredTableTypes count] == 0) { return (rowIndex != 0 ); - return ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] != SPTableTypeNone ); + } + + return ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] != SPTableTypeNone); } /** |