Fixed: the CPArrayController code to remove out of bounds selections failed to remove the last selected item if the new arrangedObjects array was empty.

This commit is contained in:
Alexander Ljungberg
2010-05-26 19:42:40 -04:00
parent 8a8af0e4a9
commit 15be647c16
+1 -1
View File
@@ -310,7 +310,7 @@
{
var objectsCount = [[self arrangedObjects] count];
// Remove out of bounds indexes.
[indexes removeIndexesInRange:CPMakeRange(objectsCount, [indexes lastIndex])];
[indexes removeIndexesInRange:CPMakeRange(objectsCount, [indexes lastIndex]+1)];
// When avoiding empty selection and the deleted selection was at the bottom, select the last item.
if(![indexes count] && _avoidsEmptySelection && objectsCount)
indexes = [CPIndexSet indexSetWithIndex:objectsCount-1];