diff options
author | Max <post@wickenrode.com> | 2016-01-31 20:15:12 +0100 |
---|---|---|
committer | Max <post@wickenrode.com> | 2016-01-31 20:15:12 +0100 |
commit | 9620e624a32fd0808e508bc5f0889ea847a185b2 (patch) | |
tree | 2fa5f9b10f390600f6eaaad67c4ccb67f53cf820 /Source | |
parent | c196132146dab618005bd88057dd61764f855808 (diff) | |
download | sequelpro-9620e624a32fd0808e508bc5f0889ea847a185b2.tar.gz sequelpro-9620e624a32fd0808e508bc5f0889ea847a185b2.tar.bz2 sequelpro-9620e624a32fd0808e508bc5f0889ea847a185b2.zip |
Fix an exception that would occur when passing NSNull to a tooltip (affected CSV field mapper)
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPFieldMapperController.m | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m index 26454f0f..6d5caf41 100644 --- a/Source/SPFieldMapperController.m +++ b/Source/SPFieldMapperController.m @@ -1768,11 +1768,16 @@ static NSUInteger SPSourceColumnTypeInteger = 1; } else if([importFieldNamesHeaderSwitch state] == NSOffState) { - if([NSArrayObjectAtIndex(fieldMappingArray, rowIndex) unsignedIntegerValue]>=[NSArrayObjectAtIndex(fieldMappingImportArray, 0) count]) - return NSArrayObjectAtIndex(fieldMappingGlobalValues, [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]); + NSUInteger colIndex = [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) unsignedIntegerValue]; + NSString *retval; + if(colIndex >= [NSArrayObjectAtIndex(fieldMappingImportArray, 0) count]) + retval = NSArrayObjectAtIndex(fieldMappingGlobalValues, colIndex); else - return NSArrayObjectAtIndex(NSArrayObjectAtIndex(fieldMappingImportArray, fieldMappingCurrentRow), [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]); + retval = NSArrayObjectAtIndex(NSArrayObjectAtIndex(fieldMappingImportArray, fieldMappingCurrentRow), colIndex); + + if([retval isNSNull]) retval = NSLocalizedString(@"Value will be imported as MySQL NULL", @"CSV Field Mapping : Table View : Tooltip for fields with NULL value"); + return retval; } } |