aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPExportFilenameUtilities.m
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2014-08-01 01:18:44 +0200
committerMax <post@wickenrode.com>2014-08-01 01:18:44 +0200
commit2570a91dd1e1d7b88b908db33494baeaa5001e74 (patch)
treec48635205db38479c7ef05b05c394169317271bc /Source/SPExportFilenameUtilities.m
parentb2e63fad01ca76b9090c1a0adbd999990d817846 (diff)
downloadsequelpro-2570a91dd1e1d7b88b908db33494baeaa5001e74.tar.gz
sequelpro-2570a91dd1e1d7b88b908db33494baeaa5001e74.tar.bz2
sequelpro-2570a91dd1e1d7b88b908db33494baeaa5001e74.zip
Fix for exception on export (#1968)
This fixes an exception that would happen if three conditions were met: 1) No database was selected or it was empty 2) A custom export filename was set 3) You tried to export the result of a custom query
Diffstat (limited to 'Source/SPExportFilenameUtilities.m')
-rw-r--r--Source/SPExportFilenameUtilities.m4
1 files changed, 3 insertions, 1 deletions
diff --git a/Source/SPExportFilenameUtilities.m b/Source/SPExportFilenameUtilities.m
index d9637e4d..71422b28 100644
--- a/Source/SPExportFilenameUtilities.m
+++ b/Source/SPExportFilenameUtilities.m
@@ -47,7 +47,8 @@
// Get the current export file extension
NSString *extension = [self currentDefaultExportFileExtension];
- filename = [self expandCustomFilenameFormatUsingTableName:[[tablesListInstance tables] objectAtIndex:1]];
+ //note that there will be no tableName if the export is done from a query result without a database selected (or empty).
+ filename = [self expandCustomFilenameFormatUsingTableName:[[tablesListInstance tables] objectOrNilAtIndex:1]];
if (![[filename pathExtension] length] && [extension length] > 0) filename = [filename stringByAppendingPathExtension:extension];
}
@@ -319,6 +320,7 @@
* Uses the current custom filename field as a data source.
*
* @param table A table name to be used within the expanded filename.
+ * Can be nil.
*
* @return The expanded filename.
*/