From e6cb782cce092836a2410033d0ead33037d87aa8 Mon Sep 17 00:00:00 2001 From: cacaodev Date: Mon, 10 Nov 2008 23:16:53 +0100 Subject: [PATCH] insertObjects:atIndexes: fix --- Foundation/CPArray.j | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Foundation/CPArray.j b/Foundation/CPArray.j index 90942d1..6623b02 100755 --- a/Foundation/CPArray.j +++ b/Foundation/CPArray.j @@ -906,13 +906,17 @@ @param objects the objects to add to this array @param anIndexSet the indices for the objects */ -- (void)insertObjects:(CPArray)objects atIndexes:(CPIndexSet)anIndexSet +- (void)insertObjects:(CPArray)objects atIndexes:(CPIndexSet)indexes { var index = 0, - position = CPNotFound; + position = [indexes firstIndex]; - while ((position = [indexes indexGreaterThanIndex:position]) != CPNotFound) - [self insertObject:objects[index++] atindex:position]; + while (position != CPNotFound) + { + [self insertObject:objects[index] atindex:position]; + position = [indexes indexGreaterThanIndex:position]); + index++; + } } /*! -- 1.6.0.2