Fixed ArrayController failed to recognize row 0 as the insert location

The logic is wrong in the test for last selection since it can be 0
and if there is no selection, [_selectionIndexes lastIndex] returns -1

Fixes #1723
This commit is contained in:
Blair Duncan
2013-03-14 13:49:42 -07:00
committed by Antoine Mercadal
parent c8b812bbb5
commit 009ae1e14c
+1 -1
View File
@@ -914,7 +914,7 @@
var newObject = [self automaticallyPreparesContent] ? [self newObject] : [self _defaultNewObject],
lastSelectedIndex = [_selectionIndexes lastIndex];
if (lastSelectedIndex)
if (lastSelectedIndex != CPNotFound)
[self insertObject:newObject atArrangedObjectIndex:lastSelectedIndex];
else
[self addObject:newObject];