Permalink
Browse files

Fix an exception when right-clicking in the CSV field mapping table w…

…ithout active selection (#2219)
  • Loading branch information...
dmoagx committed Nov 6, 2015
1 parent ea1d728 commit b21b4ff0c81d9dca416e7945af39c95d0c89167a
Showing with 9 additions and 3 deletions.
  1. +9 −3 Source/SPFieldMapperController.m
@@ -1604,15 +1604,21 @@ - (void)validateImportButton
*/
- (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;

0 comments on commit b21b4ff

Please sign in to comment.