diff options
author | Max <post@wickenrode.com> | 2015-11-06 01:19:36 +0100 |
---|---|---|
committer | Max <post@wickenrode.com> | 2015-11-06 01:19:36 +0100 |
commit | b21b4ff0c81d9dca416e7945af39c95d0c89167a (patch) | |
tree | 44a6f62115d1277aca81d336fd428c6eecebe05d /Source | |
parent | ea1d72868aabba227aa608a2a89079aa12ac70a1 (diff) | |
download | sequelpro-b21b4ff0c81d9dca416e7945af39c95d0c89167a.tar.gz sequelpro-b21b4ff0c81d9dca416e7945af39c95d0c89167a.tar.bz2 sequelpro-b21b4ff0c81d9dca416e7945af39c95d0c89167a.zip |
Fix an exception when right-clicking in the CSV field mapping table without active selection (#2219)
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPFieldMapperController.m | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m index 1a6cfc83..82975e0e 100644 --- a/Source/SPFieldMapperController.m +++ b/Source/SPFieldMapperController.m @@ -1604,15 +1604,21 @@ static NSUInteger SPSourceColumnTypeInteger = 1; */ - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { - NSInteger row = [fieldMapperTableView selectedRow]; // Hide/display Remove New Column menu item [[[fieldMapperTableView menu] itemAtIndex:3] setHidden:([toBeEditedRowIndexes containsIndex:row]) ? NO : YES]; if (newTableMode && [menuItem action] == @selector(setAllTypesTo:)) { - NSString *orgTitle = [[menuItem title] substringToIndex:[[menuItem title] rangeOfString:@":"].location]; - [menuItem setTitle:[NSString stringWithFormat:@"%@: %@", orgTitle, [fieldMappingTableTypes objectAtIndex:row]]]; + if(row > -1) { // row == -1 on empty selection + NSString *orgTitle = [[menuItem title] substringToIndex:[[menuItem title] rangeOfString:@":"].location]; + [menuItem setTitle:[NSString stringWithFormat:@"%@: %@", orgTitle, [fieldMappingTableTypes objectAtIndex:row]]]; + [menuItem setHidden:NO]; + } + else { + [menuItem setHidden:YES]; + return NO; + } } else if (!newTableMode && [menuItem action] == @selector(insertNULLValue:)) { return ([[globalValuesTableView selectedRowIndexes] count] == 1) ? YES : NO; |