Skip to content

Commit

Permalink
Don’t check for failure by looking at the NSError
Browse files Browse the repository at this point in the history
As per Cocoa convention, check the return value,
not the NSError.
  • Loading branch information
seanm committed Jul 22, 2015
1 parent f303720 commit f95d84b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion MiscMerge/MiscMergeTemplate.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion mogenerator.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f95d84b

Please sign in to comment.