aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPFieldMapperController.m
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2015-11-06 01:19:36 +0100
committerMax <post@wickenrode.com>2015-11-06 01:20:12 +0100
commit07135224f778af661737a83f93daaf5f092e6d7d (patch)
tree582df7cd68cefe346686f4c6cb182ca4092fbdfc /Source/SPFieldMapperController.m
parentb39eb93c5dfb9e0329b008b722e1ea96df1f216c (diff)
downloadsequelpro-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/SPFieldMapperController.m')
-rw-r--r--Source/SPFieldMapperController.m12
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;