diff --git a/Playlist/DNDArrayController.m b/Playlist/DNDArrayController.m index 50875e6cb..4dd6646cf 100755 --- a/Playlist/DNDArrayController.m +++ b/Playlist/DNDArrayController.m @@ -121,20 +121,19 @@ NSString *iTunesDropType = @"com.apple.tv.metadata"; - (void)moveObjectsFromIndex:(NSUInteger)fromIndex toArrangedObjectIndexes:(NSIndexSet *)indexSet { - NSArray *objects = [self arrangedObjects]; + NSArray *objects = [[self arrangedObjects] subarrayWithRange:NSMakeRange(fromIndex, [indexSet count])]; NSUInteger index = [indexSet firstIndex]; NSUInteger itemIndex = 0; id object; - NSArray *itemsSet = [objects objectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(fromIndex, [indexSet count])]]; - - for (NSUInteger i = 0; i < [itemsSet count]; i++) { - [self removeObjectAtArrangedObjectIndex:fromIndex]; + fromIndex += [objects count]; + for (NSUInteger i = 0; i < [objects count]; i++) { + [self removeObjectAtArrangedObjectIndex:--fromIndex]; } while (NSNotFound != index) { - object = itemsSet[itemIndex++]; + object = objects[itemIndex++]; [self insertObject:object atArrangedObjectIndex:index];