Skip to content

Commit 64f9c6a

Browse files
committed
Added an assertion that checks when user is trying to add rows to a closed section.
1 parent be46538 commit 64f9c6a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

FZAccordionTableView/FZAccordionTableView.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,14 @@ - (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAn
228228
}
229229
}
230230

231+
- (void)insertRowsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation
232+
{
233+
for (NSIndexPath *indexPath in indexPaths) {
234+
NSAssert([self.sectionInfos[indexPath.section] isOpen], @"Can't insert rows in a closed section: %d.", (int)indexPath.section);
235+
}
236+
[super insertRowsAtIndexPaths:indexPaths withRowAnimation:animation];
237+
}
238+
231239
#pragma mark - Forwarding handling -
232240

233241
- (id)forwardingTargetForSelector:(SEL)aSelector {

0 commit comments

Comments
 (0)