Re: NSScanner Failing with EXC_BAD_ACCESS
Re: NSScanner Failing with EXC_BAD_ACCESS
- Subject: Re: NSScanner Failing with EXC_BAD_ACCESS
- From: Bill Bumgarner <email@hidden>
- Date: Fri, 15 Oct 2010 14:12:27 -0700
On Oct 15, 2010, at 12:00 PM, Hank Heijink (Mailinglists) wrote:
>> NSString *theScannedString;
>
> I would set theScannedString to nil here to avoid your crash below.
That would be making the assumption that the implementation of scanCharactersFromSet:intoString: does not muck with the pointer regardless of return value.
Making such an assumption is no more safe here than it is with NSError** parameters.
Check the return value and ***ONLY*** use the pass-by-reference return value if success is indicated.
To do otherwise is to beg for a crash in the future.
b.bum
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden