Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fix an exception when right-clicking in the CSV field mapping table w…
…ithout active selection (#2219)
- Loading branch information
Showing
with
9 additions
and
3 deletions.
-
+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; |
|
|