@@ -632,7 +632,7 @@ export class CollectionView extends CollectionViewBase {
632632 const indexes = NSMutableArray . new < NSIndexPath > ( ) ;
633633 for ( let index = 0 ; index < event . addedCount ; index ++ ) {
634634 indexes . addObject ( NSIndexPath . indexPathForRowInSection ( event . index + index , 0 ) ) ;
635- if ( sizes ) {
635+ if ( sizes && event . index < sizes . count ) {
636636 sizes . insertObjectAtIndex ( NSValue . valueWithCGSize ( CGSizeZero ) , event . index ) ;
637637 }
638638 // this._sizes.splice(index, 0, null);
@@ -664,7 +664,7 @@ export class CollectionView extends CollectionViewBase {
664664 const indexes = NSMutableArray . new < NSIndexPath > ( ) ;
665665 for ( let index = 0 ; index < event . removed . length ; index ++ ) {
666666 indexes . addObject ( NSIndexPath . indexPathForItemInSection ( event . index + index , 0 ) ) ;
667- if ( sizes ) {
667+ if ( sizes && event . index < sizes . count ) {
668668 sizes . removeObjectAtIndex ( event . index ) ;
669669 }
670670 }
@@ -679,7 +679,7 @@ export class CollectionView extends CollectionViewBase {
679679 const indexes = NSMutableArray . alloc < NSIndexPath > ( ) . init ( ) ;
680680 for ( let index = 0 ; index < event . addedCount ; index ++ ) {
681681 indexes . addObject ( NSIndexPath . indexPathForItemInSection ( event . index + index , 0 ) ) ;
682- if ( sizes ) {
682+ if ( sizes && event . index < sizes . count ) {
683683 sizes . insertObjectAtIndex ( NSValue . valueWithCGSize ( CGSizeZero ) , event . index ) ;
684684 }
685685 // this._sizes.splice(event.index, 0, null);
0 commit comments