From 0e522d9bd52a2b1be6295ee5e196ffece4b9ae6c Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Sun, 25 Aug 2013 22:32:28 +0000 Subject: - Fix an exception on 10.6 when clicking below the table list rows (http://spbug.com/l/1726) --- Source/SPTablesList.m | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'Source') 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); } /** -- cgit v1.2.3