From 776a299e57ea18e7c30d8747db32436bbae932ef Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Thu, 30 Aug 2012 00:43:40 +0000 Subject: - Add dummy implementations of NSDocument data reading and writing to prevent exceptions when they appear to get called. This should address Issue #1411. --- Source/SPDocumentController.m | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'Source/SPDocumentController.m') 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 -- cgit v1.2.3