Re: Out of Bounds Exception
Re: Out of Bounds Exception
- Subject: Re: Out of Bounds Exception
- From: Andy Lee <email@hidden>
- Date: Sat, 16 Mar 2002 22:06:38 -0500
At 9:44 PM -0500 3/16/02, Andrew Pinski wrote:
>
I think the problem is that [DictionaryOfArrays1 objectForKey: keyToAnArray] == [DictionaryOfArrays2 objectForKey: keyToAnArray].
>
Yup, that's it. I just confirmed Andrew's hypothesis. The following code:
- - - - -
NSMutableArray *mainArray = [NSMutableArray arrayWithCapacity:5];
[mainArray addObject:@"hello"];
[mainArray addObject:@"goodbye"];
NSLog(@"mainArray BEFORE:%@", mainArray);
[mainArray removeObjectsInArray:mainArray];
NSLog(@"mainArray AFTER:%@\n\n", mainArray);
- - - - -
gives the following output:
- - - - -
2002-03-16 22:01:53.284 PersonalDays[16887] mainArray BEFORE:<CFArray 0x15bd580 [0x8016024c]>{type = mutable-small, count = 2, values = (
0 : hello
1 : goodbye
)}
2002-03-16 22:01:53.356 PersonalDays[16887] *** -[NSCFArray objectAtIndex:]: index (1) beyond bounds (1)
- - - - -
But if you comment out one of the [mainArray addObject:...] lines (so mainArray no longer has multiple elements), no exception is thrown.
Good catch!
>
>
PS Please send a bug report.
Yes, please do.
--Andy
_______________________________________________
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.