On 4 Jun 2008, at 21:50, Shawn Erickson wrote:

On Wed, Jun 4, 2008 at 6:18 AM, Gerriet M. Denkmann
<[EMAIL PROTECTED]> wrote:

When this table contains some rows and I click on the table column header I
always get:
*** -[NSCFArray objectAtIndex:]: index (-1) beyond bounds (5)
where 5 is the correct number of rows displayed.

What am I doing wrong?
This is on Tiger 10.4.11

Need to see some code likely... Are you using a data source? or
controller layer (bindings)?
Bindings.

You can set a break point on the above method and make it conditional
on the index being -1 to see the code path that is hitting this. Also
I think that is an exception so you can set a break point on ... humm
sorry cannot recall the low level throw method on 10.4 (not enough
coffee yet).

I used a breakpoint on:
-[NSException raise]

and found the error in my own code:

- (IBAction)tableClicked: sender;
{
        int clickedRow = [ sender clickedRow ];
if ( clickedRow < 0 ) return; // clicked in column header <--- this line was missing
        id arrangedObjects = [ tableArrayController arrangedObjects ];  
NSMetadataItem *item = [ arrangedObjects objectAtIndex: clickedRow ]; <--- raised exception

I should have thought of the debugger before asking here.
Sorry for the noise!

Kind regards

Gerriet.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to