-[AMWorkflow initWithContentsOfURL:error:] throws an exception when NSURL is nil

Originator:vincent.gable
Number:rdar://6439685 Date Originated:11-Dec-2008 05:03 PM
Status:Open Resolved:
Product:Automator.framework Product Version:10.5.5
Classification:Other Bug/Workaround Reproducible:Always
 
When I tried to create an AMWorkflow with -[AMWorkflow initWithContentsOfURL:error:],  and passed in a nil NSURL, my program was terminated, and 
"*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFDictionary initWithObjects:forKeys:count:]: attempt to insert nil value at objects[0] (key: NSURL)'"
was printed to the console.

I expected the "error:" output-parameter to return an NSError explaining any reasons the AMWorklfow couldn't be made.

Steps to Reproduce:

id error = nil;
AMWorkflow *workflow = [[AMWorkflow alloc] initWithContentsOfURL:nil error:&error];
NSLog(@"workflow = %@, error = %@", workflow, error); //never get here

Results:
I expected the "error:" output-parameter to return an NSError explaining any reasons the AMWorklfow couldn't be made.  If an argument was invalid, I expected the NSError to explain this.  I did not expect an NSInvalidArgumentException to be thrown.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!