Skip to content

Commit 3de6a0c

Browse files
committed
Fix a crash in demo
1 parent fdf26dc commit 3de6a0c

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Demo/Demo/FDFeedViewController.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,9 @@ - (void)configureCell:(FDFeedCell *)cell atIndexPath:(NSIndexPath *)indexPath {
9494

9595
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
9696
FDSimulatedCacheMode mode = self.cacheModeSegmentControl.selectedSegmentIndex;
97-
NSString *reuseIdentifier = @"FDFeedCell";
9897
switch (mode) {
9998
case FDSimulatedCacheModeNone:
100-
return [tableView fd_heightForCellWithIdentifier:reuseIdentifier configuration:^(FDFeedCell *cell) {
99+
return [tableView fd_heightForCellWithIdentifier:@"FDFeedCell" configuration:^(FDFeedCell *cell) {
101100
[self configureCell:cell atIndexPath:indexPath];
102101
}];
103102
case FDSimulatedCacheModeCacheByIndexPath:
@@ -169,11 +168,12 @@ - (FDFeedEntity *)randomEntity {
169168

170169
- (void)insertRow {
171170
if (self.feedEntitySections.count == 0) {
172-
self.feedEntitySections[0] = @[].mutableCopy;
171+
[self insertSection];
172+
} else {
173+
[self.feedEntitySections[0] insertObject:self.randomEntity atIndex:0];
174+
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
175+
[self.tableView insertRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
173176
}
174-
[self.feedEntitySections[0] insertObject:self.randomEntity atIndex:0];
175-
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
176-
[self.tableView insertRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
177177
}
178178

179179
- (void)insertSection {

0 commit comments

Comments
 (0)