• 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
Out-of-bounds error when removing entry from NSForm
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Out-of-bounds error when removing entry from NSForm


  • Subject: Out-of-bounds error when removing entry from NSForm
  • From: Sam Stigler <email@hidden>
  • Date: Tue, 15 May 2007 13:50:59 +1000

I'm hoping you can please provide some insight into this... I have an NSForm inside a custom view which is then inside a drawer. I then want my tableViewSelectionDidChange: method to update the form with the metadata of the selection, which represents a file. This requires that I programatically control how many entries are in the form. The first step here is to remove all the current metadata entries from the form, right? But if I'm starting from the basic IB palette form with two entries, and I use the following code (see below), I get an array out-of-bounds error in [NSForm removeRow:] (see stack trace, also below). Does anyone have any idea why this could be happening? I also tried [NSForm removeEntryAtIndex:], but that raised the same error, basically, with a very similar stack trace: Apparently it calls [NSMatrix removeRow:]. I'm guessing this is some really basic mistake that I'm just not seeing; does anyone have any idea how I could fix this? Every time I run it, numrows is 2. This out of bounds just doesn't make sense...

Thanks,
Sam


The first part of the method:

-(void)tableViewSelectionDidChange:(NSNotification *)aNotification {

if (([[aNotification object] isEqualTo:itemTable]) && ([[items selectedObjects] count] == 0)) {
int numrows = [metadataForm numberOfRows];
int curRow = 0;
for (curRow; curRow < numrows; curRow++) {
[metadataForm removeRow:curRow];
}
}


The stack trace:
-[NSException raise]
+[NSException raise:format]
_NSArrayRaiseBoundException
-[NSCFArray objectAtIndex:]
-[NSMatrix removeRow:]
-[myDocument tableView selectionDidChange:]

etc.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Out-of-bounds error when removing entry from NSForm
      • From: George Orthwein <email@hidden>
  • Prev by Date: Custom NSCell Editing Question
  • Next by Date: Re: Custom NSCell Editing Question
  • Previous by thread: Re: Custom NSCell Editing Question
  • Next by thread: Re: Out-of-bounds error when removing entry from NSForm
  • Index(es):
    • Date
    • Thread