aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2012-08-30 00:43:40 +0000
committerrowanbeentje <rowan@beent.je>2012-08-30 00:43:40 +0000
commit776a299e57ea18e7c30d8747db32436bbae932ef (patch)
treea1d98bb23c3cfb09ee7f39db657d9f67c9ed8c91
parent28734c995b3f97d8eb50610cfd6d7ad62697d2cb (diff)
downloadsequelpro-776a299e57ea18e7c30d8747db32436bbae932ef.tar.gz
sequelpro-776a299e57ea18e7c30d8747db32436bbae932ef.tar.bz2
sequelpro-776a299e57ea18e7c30d8747db32436bbae932ef.zip
- Add dummy implementations of NSDocument data reading and writing to prevent exceptions when they appear to get called. This should address Issue #1411.
-rw-r--r--Source/SPDocumentController.m26
1 files changed, 26 insertions, 0 deletions
diff --git a/Source/SPDocumentController.m b/Source/SPDocumentController.m
index 8e6d75e1..f843155a 100644
--- a/Source/SPDocumentController.m
+++ b/Source/SPDocumentController.m
@@ -34,9 +34,35 @@
@implementation SPDocumentController
+
/**
* This is an empty, dummy implementation; this allows Sequel Pro to behave
* as if it were a document-based application.
*/
+
+/**
+ * Add a dummy implementation of readFromData:ofType:error:, which appears to
+ * be called by the OS in certain situations despite non-document use.
+ * (See http://code.google.com/p/sequel-pro/issues/detail?id=1411 )
+ */
+- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError
+{
+ if (outError) {
+ *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL];
+ }
+ return YES;
+}
+
+/**
+ * Add a dummy implementation of data:ofType:error: in case of similar OS calls.
+ */
+- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError
+{
+ if (outError) {
+ *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL];
+ }
+ return nil;
+}
+
@end