diff options
author | Max <post@wickenrode.com> | 2015-11-06 01:19:36 +0100 |
---|---|---|
committer | Max <post@wickenrode.com> | 2015-11-06 01:20:12 +0100 |
commit | 07135224f778af661737a83f93daaf5f092e6d7d (patch) | |
tree | 582df7cd68cefe346686f4c6cb182ca4092fbdfc /Source | |
parent | b39eb93c5dfb9e0329b008b722e1ea96df1f216c (diff) | |
download | sequelpro-07135224f778af661737a83f93daaf5f092e6d7d.tar.gz sequelpro-07135224f778af661737a83f93daaf5f092e6d7d.tar.bz2 sequelpro-07135224f778af661737a83f93daaf5f092e6d7d.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 9bef9d03..cc560ac0 100644 --- a/Source/SPFieldMapperController.m +++ b/Source/SPFieldMapperController.m @@ -1606,15 +1606,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; |