Skip to content

Commit

Permalink
Crash when loading json (#145)
Browse files Browse the repository at this point in the history
* nil section header labels are now replaced with empty string avoiding a crash

* label check now checks against section (not _sections)
  • Loading branch information
intmainvoid authored and aksonov committed Nov 22, 2017
1 parent 0975bc3 commit 6899c44
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions RNTableView/RNTableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ @implementation RNTableView {

- (void)setEditing:(BOOL)editing {
_editing = editing;

[self.tableView setEditing:editing animated:YES];
}

Expand Down Expand Up @@ -174,7 +174,8 @@ - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
NSMutableArray *keys = [NSMutableArray arrayWithCapacity:[_sections count]];

for (NSDictionary *section in _sections){
[keys addObject:section[@"label"]];
NSString *label = section[@"label"] ?: @"";
[keys addObject:label];
}

return keys;
Expand Down

0 comments on commit 6899c44

Please sign in to comment.