From 233df3bdabd86995ef3d6a3d1744a868b0366e3f Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Wed, 11 Aug 2010 23:28:06 -0400 Subject: [PATCH] Fixed: the "fix for column reordering with hidden columns" sometimes caused the table view to try to remove nonexistent data views and crash. The fix is to consider a nonexistent data view already removed and just move on. --- AppKit/CPTableView.j | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index 27884902d..929f4a139 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -2277,9 +2277,14 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; for (; rowIndex < rowsCount; ++rowIndex) { var row = rowArray[rowIndex], - dataView = [_dataViewsForTableColumns[tableColumnUID] objectAtIndex:row]; + dataViews = _dataViewsForTableColumns[tableColumnUID]; - [_dataViewsForTableColumns[tableColumnUID] replaceObjectAtIndex:row withObject:nil]; + if (!dataViews || row >= dataViews.length) + continue; + + var dataView = [dataViews objectAtIndex:row]; + + [dataViews replaceObjectAtIndex:row withObject:nil]; [self _enqueueReusableDataView:dataView]; } @@ -3722,14 +3727,14 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey", CGContextSetStrokeColor(context, _lineColor); var points = [ - _CGPointMake(0.5, 0), + _CGPointMake(0.5, 0), _CGPointMake(0.5, aRect.size.height) ]; CGContextStrokeLineSegments(context, points, 2); - + points = [ - _CGPointMake(aRect.size.width - 0.5, 0), + _CGPointMake(aRect.size.width - 0.5, 0), _CGPointMake(aRect.size.width - 0.5, aRect.size.height) ];