Re: EXC_BAD_ACCESS in an strange place
Re: EXC_BAD_ACCESS in an strange place
- Subject: Re: EXC_BAD_ACCESS in an strange place
- From: Chris Ridd <email@hidden>
- Date: Fri, 23 Aug 2002 13:25:46 +0100
Clark Mueller <email@hidden> wrote:
>
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?
Perhaps the files object has been released prior to you sending it the
count message.
Cheers,
Chris
_______________________________________________
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.