+[NSURL URLWithString:] throws an exception if string is nil
Originator: | vincent.gable | ||
Number: | rdar://6810626 | Date Originated: | 2009-04-20 |
Status: | Behaves correctly | Resolved: | 2009-04-29 |
Product: | Mac OS X/iPhone OS | Product Version: | 10.5.6 / 2.2.1 |
Classification: | Reproducible: | Always |
20-Apr-2009 10:17 PM Vincent Gable: Summary: [NSURL URLWithString:nil]; throws exception 'NSInvalidArgumentException', reason: '*** -[NSURL initWithString:relativeToURL:]: nil string parameter' Documentation says: "Return Value An NSURL object initialized with URLString. If the string was malformed, returns nil." no mention of an exception being thrown. Steps to Reproduce: execute [NSURL URLWithString:nil]; Expected Results: nil Actual Results: An exception is thrown, app "crashes". Regression: Unknown Notes: Tested on Mac OS X 10.5.6, iPhone simulator on same with 2.2.1 iPhone OS; 3G iPhone with 2.2.1 OS.
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!
Looks like this changed in 10.7 so +URLWithString: handles nil strings.