• 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
Re: Out of Bounds Exception
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: Out of Bounds Exception (From: Andrew Pinski <email@hidden>)

  • Prev by Date: Re: Out of Bounds Exception
  • Next by Date: Re: Why the name Cocoa?
  • Previous by thread: Re: Out of Bounds Exception
  • Next by thread: Re: Out of Bounds Exception
  • Index(es):
    • Date
    • Thread