diff --git a/AppKit/CPCollectionView.j b/AppKit/CPCollectionView.j index caa414c96..98a2ea69b 100644 --- a/AppKit/CPCollectionView.j +++ b/AppKit/CPCollectionView.j @@ -1217,7 +1217,10 @@ Not supported. Use -collectionView:dataForItemsAtIndexes:fortype: - (void)_modifySelectionWithNewIndex:(int)anIndex direction:(int)aDirection expand:(BOOL)shouldExpand { - anIndex = MIN(MAX(anIndex, 0), [[self items] count] - 1); + var count = [[self items] count]; + if (count === 0) + return; + anIndex = MIN(MAX(anIndex, 0), count - 1); if (_allowsMultipleSelection && shouldExpand) {