• 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
EXC_BAD_ACCESS in an strange place
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

EXC_BAD_ACCESS in an strange place


  • Subject: EXC_BAD_ACCESS in an strange place
  • From: Clark Mueller <email@hidden>
  • Date: Thu, 22 Aug 2002 23:27:28 -0600

Hello everyone,

I have an interesting problem with some code that really just doesn't
want to play right. The following chunk of code triggers an
EXC_BAD_ACCESS right at the line that calls [files count].

> if( files == nil ){
> RunAlertPanel(@"Sorry, the operation can't continue.");
> return;
> }
>
> if( [files count] < 1 ){ // <<--- EXC_BAD_ACCESS happens here
> RunAlertPanel(@"The folder is empty.");
> return;
> }

Some background info, first. "files" is an NSArray declared as a class
variable, accessible to this code. It does get initialized, and even if
it didn't, this is the weird part... A crash of this type would make me
believe that "files" is not initialized, and calling "count" on an
unallocated object causes the crash. But why doesn't the line right
above, to check for whether files is initialized catch that and tell me?

TIA,

Clark
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: EXC_BAD_ACCESS in an strange place
      • From: Chris Ridd <email@hidden>
  • Prev by Date: Re: when a scrollbar is really needed?
  • Next by Date: Sherlock 3
  • Previous by thread: Menu accelerators - how not to fire them
  • Next by thread: Re: EXC_BAD_ACCESS in an strange place
  • Index(es):
    • Date
    • Thread