From 3d8accc866c35c41717188f933d77f48c708a69f Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 12 Jun 2015 00:01:01 +0200 Subject: Fix a popular exception when a user tried to edit a field with a lost connection and then chose "disconnect" when Sequel Pro asks to reconnect (attempt at #2137) --- Source/SPCopyTable.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Source/SPCopyTable.m') diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m index 2b5554b5..439ff84d 100644 --- a/Source/SPCopyTable.m +++ b/Source/SPCopyTable.m @@ -495,8 +495,9 @@ static const NSInteger kBlobAsImageFile = 4; // If the data is not loaded, attempt to fetch the value if ([cellData isSPNotLoaded] && [[self delegate] isKindOfClass:spTableContentClass]) { + NSString *whereArgument = [tableInstance argumentForRow:rowIndex]; // Abort if no table name given, not table content, or if there are no indices on this table - if (!selectedTable || ![[self delegate] isKindOfClass:spTableContentClass] || ![(NSString*)[tableInstance argumentForRow:rowIndex] length]) { + if (!selectedTable || ![[self delegate] isKindOfClass:spTableContentClass] || ![whereArgument length]) { NSBeep(); free(columnMappings); free(columnTypes); @@ -509,7 +510,7 @@ static const NSInteger kBlobAsImageFile = 4; [NSString stringWithFormat:@"SELECT %@ FROM %@ WHERE %@", [NSArrayObjectAtIndex(tbHeader, columnMappings[c]) backtickQuotedString], [selectedTable backtickQuotedString], - [tableInstance argumentForRow:rowIndex]]]; + whereArgument]]; } // Check for NULL value -- cgit v1.2.3