From 009ae1e14cd32b603f53999ea0d578dca78c07b3 Mon Sep 17 00:00:00 2001 From: Blair Duncan Date: Thu, 14 Mar 2013 12:33:17 -0400 Subject: [PATCH] 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 --- AppKit/CPArrayController.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/CPArrayController.j b/AppKit/CPArrayController.j index 4e3c3c04f..5cf53d08f 100644 --- a/AppKit/CPArrayController.j +++ b/AppKit/CPArrayController.j @@ -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];