aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPTableData.m2
-rw-r--r--Source/TableContent.m5
-rw-r--r--Source/TablesList.m13
3 files changed, 14 insertions, 6 deletions
diff --git a/Source/SPTableData.m b/Source/SPTableData.m
index 5657dd2c..a5e29a9d 100644
--- a/Source/SPTableData.m
+++ b/Source/SPTableData.m
@@ -75,7 +75,7 @@
[self updateInformationForCurrentTable];
}
}
- return [NSString stringWithString:tableEncoding];
+ return (tableEncoding == nil) ? nil : [NSString stringWithString:tableEncoding];
}
/*
diff --git a/Source/TableContent.m b/Source/TableContent.m
index 855c44ca..da8a9745 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -110,8 +110,9 @@
[tableContentView removeTableColumn:[theColumns objectAtIndex:0]];
}
- // If no table has been supplied, reset the view to a blank table and disabled elements
- if ( [aTable isEqualToString:@""] || !aTable )
+ // If no table has been supplied, reset the view to a blank table and disabled elements.
+ // [tableDataInstance tableEncoding] == nil indicates that an error occured while retrieving table data
+ if ( [aTable isEqualToString:@""] || !aTable || [tableDataInstance tableEncoding] == nil)
{
// Empty the stored data arrays
[fullResult removeAllObjects];
diff --git a/Source/TablesList.m b/Source/TablesList.m
index 2d8ad1dc..d90f7972 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -1106,11 +1106,14 @@
if( [[tableTypes objectAtIndex:[tablesListView selectedRow]] intValue] == SP_TABLETYPE_VIEW ||
[[tableTypes objectAtIndex:[tablesListView selectedRow]] intValue] == SP_TABLETYPE_TABLE) {
+
+ // tableEncoding == nil indicates that there was an error while retrieving table data
+ NSString *tableEncoding = [tableDataInstance tableEncoding];
// If encoding is set to Autodetect, update the connection character set encoding
// based on the newly selected table's encoding - but only if it differs from the current encoding.
if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultEncoding"] isEqualToString:@"Autodetect"]) {
- if (![[tableDataInstance tableEncoding] isEqualToString:[tableDocumentInstance connectionEncoding]]) {
- [tableDocumentInstance setConnectionEncoding:[tableDataInstance tableEncoding] reloadingViews:NO];
+ if (tableEncoding != nil && ![tableEncoding isEqualToString:[tableDocumentInstance connectionEncoding]]) {
+ [tableDocumentInstance setConnectionEncoding:tableEncoding reloadingViews:NO];
[tableDataInstance resetAllData];
}
}
@@ -1121,7 +1124,11 @@
contentLoaded = NO;
statusLoaded = NO;
} else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 1 ) {
- [tableContentInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
+ if(tableEncoding == nil) {
+ [tableContentInstance loadTable:nil];
+ } else {
+ [tableContentInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
+ }
structureLoaded = NO;
contentLoaded = YES;
statusLoaded = NO;