From 845ecf82990086e282eaedf00d2ae8aa2df3d1ae Mon Sep 17 00:00:00 2001 From: Andrew Barnert Date: Fri, 5 Oct 2012 12:37:16 -0700 Subject: [PATCH] Some methods did not check for null NSError** param. - Many of the methods in `AEMApplication`, `AEMEvent`, etc. follow the usual ObjC idiom of taking an optional `NSError** error`, but some of the methods in `AEMApplication` are missing checks for null, and therefore crash on `*error=nil`. --- objc-appscript/trunk/src/Appscript/application.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/objc-appscript/trunk/src/Appscript/application.m b/objc-appscript/trunk/src/Appscript/application.m index c9d6237..0b64cbd 100644 --- a/objc-appscript/trunk/src/Appscript/application.m +++ b/objc-appscript/trunk/src/Appscript/application.m @@ -17,12 +17,12 @@ + (NSURL *)findApplicationForCreator:(OSType)creator bundleID:(NSString *)bundleID name:(NSString *)name error:(out NSError **)error { - OSErr err; + OSStatus err; CFURLRef outAppURL; NSString *errorDescription; NSDictionary *errorInfo; - *error = nil; + if (error) *error = nil; err = LSFindApplicationForInfo(creator, (CFStringRef)bundleID, (CFStringRef)name, @@ -70,7 +70,7 @@ + (pid_t)findProcessIDForApplication:(NSURL *)fileURL error:(out NSError **)erro NSDictionary *errorInfo; pid_t pid; - *error = nil; + if (error) *error = nil; if (!fileURL || !CFURLGetFSRef((CFURLRef)fileURL, &desired)) { err = errFSBadFSRef; goto error; @@ -155,7 +155,7 @@ + (pid_t)launchApplication:(NSURL *)fileURL NSString *errorDescription; NSDictionary *errorInfo; - *error = nil; + if (error) *error = nil; if (!fileURL || !CFURLGetFSRef((CFURLRef)fileURL, &fsRef)) { err = fnfErr; goto error;