From f95d84b8dc5f069fad3fa4a4a04008759fc9e298 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 22 Jul 2015 12:20:10 -0400 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20check=20for=20failure=20by=20lo?= =?UTF-8?q?oking=20at=20the=20NSError?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As per Cocoa convention, check the return value, not the NSError. --- MiscMerge/MiscMergeTemplate.m | 2 +- mogenerator.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MiscMerge/MiscMergeTemplate.m b/MiscMerge/MiscMergeTemplate.m index 30c13af5..9e8e3442 100755 --- a/MiscMerge/MiscMergeTemplate.m +++ b/MiscMerge/MiscMergeTemplate.m @@ -136,7 +136,7 @@ - (NSString *) contentsOfFileWithName:(NSString *)filename { encoding:NSUTF8StringEncoding error:&error]; - if (error != nil) { + if (fileString == nil) { NSLog(@"%@: Could not read template file %@ because %@", [self class], filename, [error localizedDescription]); } return fileString; diff --git a/mogenerator.m b/mogenerator.m index 56dad8e7..77808650 100644 --- a/mogenerator.m +++ b/mogenerator.m @@ -823,7 +823,7 @@ - (void)setModel:(NSString*)momOrXCDataModelFilePath { // Cool, the model is in the Xcode 4.0+ format, we can compile it ourselves. NSError *compileError = nil; momFilePath = [NSManagedObjectModel compileModelAtPath:momOrXCDataModelFilePath inDirectory:NSTemporaryDirectory() error:&compileError]; - if (compileError) { + if (momFilePath == nil) { NSLog(@"Error: %@", [compileError localizedDescription]); } assert(momFilePath);