• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSScanner Failing with EXC_BAD_ACCESS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >NSScanner Failing with EXC_BAD_ACCESS (From: Chris Tracewell <email@hidden>)
 >Re: NSScanner Failing with EXC_BAD_ACCESS (From: "Hank Heijink (Mailinglists)" <email@hidden>)

  • Prev by Date: Re: What is the expected Cocoa API behavior in an incomplete object traversal?
  • Next by Date: Re: Smooth scrolling in NSScrollView
  • Previous by thread: Re: NSScanner Failing with EXC_BAD_ACCESS
  • Next by thread: Re: NSScanner Failing with EXC_BAD_ACCESS
  • Index(es):
    • Date
    • Thread