Skip to content

Commit b21b4ff

Browse files
committed
Fix an exception when right-clicking in the CSV field mapping table without active selection (#2219)
1 parent ea1d728 commit b21b4ff

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Source/SPFieldMapperController.m

+9-3
Original file line numberDiff line numberDiff line change
@@ -1604,15 +1604,21 @@ - (void)validateImportButton
16041604
*/
16051605
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
16061606
{
1607-
16081607
NSInteger row = [fieldMapperTableView selectedRow];
16091608

16101609
// Hide/display Remove New Column menu item
16111610
[[[fieldMapperTableView menu] itemAtIndex:3] setHidden:([toBeEditedRowIndexes containsIndex:row]) ? NO : YES];
16121611

16131612
if (newTableMode && [menuItem action] == @selector(setAllTypesTo:)) {
1614-
NSString *orgTitle = [[menuItem title] substringToIndex:[[menuItem title] rangeOfString:@":"].location];
1615-
[menuItem setTitle:[NSString stringWithFormat:@"%@: %@", orgTitle, [fieldMappingTableTypes objectAtIndex:row]]];
1613+
if(row > -1) { // row == -1 on empty selection
1614+
NSString *orgTitle = [[menuItem title] substringToIndex:[[menuItem title] rangeOfString:@":"].location];
1615+
[menuItem setTitle:[NSString stringWithFormat:@"%@: %@", orgTitle, [fieldMappingTableTypes objectAtIndex:row]]];
1616+
[menuItem setHidden:NO];
1617+
}
1618+
else {
1619+
[menuItem setHidden:YES];
1620+
return NO;
1621+
}
16161622
}
16171623
else if (!newTableMode && [menuItem action] == @selector(insertNULLValue:)) {
16181624
return ([[globalValuesTableView selectedRowIndexes] count] == 1) ? YES : NO;

0 commit comments

Comments
 (0)