• 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
Weird Fix for EXC_BAD_ACCESS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Weird Fix for EXC_BAD_ACCESS


  • Subject: Weird Fix for EXC_BAD_ACCESS
  • From: Duncan Oliver <email@hidden>
  • Date: Thu, 24 Jul 2003 12:56:24 -0500

I have a bit of code that tries to find the "owner" dictionary of an object. Each item is a dictionary that consist of a NSString under key "name" and an array of similar objects under key "contents" the code is suppose to look for the parent, starting from the top array, collection:

- (NSMutableDictionary *)searchDeepArrayOfItem:(NSMutableDictionary *)scope forObject:(NSMutableDictionary *)query;
{
NSEnumerator *enumerator;
NSMutableDictionary *object, *result;
NSMutableArray *array;

if (scope == nil)
array = collection;
else
array = [scope objectForKey:@"contents"];

if ([array indexOfObject:query] == NSNotFound)
{
enumerator = [array objectEnumerator];
while (object = [enumerator nextObject])
{
result = [self searchDeepArrayOfItem:object forObject:query];
if (result != nil)
break;
}
}
else
result = scope;

return result;
}

The problem is that I always get a "EXC_BAD_ACCESS", unless I change this:

result = [self searchDeepArrayOfItem:object forObject:query];
if (result != nil)
break;

to this:

NSLog(//any text will do here);
result = [self searchDeepArrayOfItem:object forObject:query];
if (result != nil)
break;


I can't figure out why adding an NSLog would allow the code to execute properly. Any ideas?

Duncan Oliver
email@hidden
_______________________________________________
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.

  • Prev by Date: Question about loading nib (RE: accessing view in a nib)
  • Next by Date: Re: Bug reports and documentation updates
  • Previous by thread: Re: Question about loading nib (RE: accessing view in a nib)
  • Next by thread: Re: Weird Fix for EXC_BAD_ACCESS
  • Index(es):
    • Date
    • Thread