Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 b21b4ff
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Source/SPFieldMapperController.m
Expand Up @@ -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;
Expand Down

0 comments on commit b21b4ff

Please sign in to comment.