diff --git a/AppKit/CPCollectionView.j b/AppKit/CPCollectionView.j index 16f289bb7..0df770496 100644 --- a/AppKit/CPCollectionView.j +++ b/AppKit/CPCollectionView.j @@ -1210,7 +1210,12 @@ 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) {