EXC_BAD_ACCESS in an strange place
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.