From 6899c44838399c715bf1013102158079ecd975d0 Mon Sep 17 00:00:00 2001 From: Gavin Conway Date: Wed, 22 Nov 2017 20:07:59 +1100 Subject: [PATCH] Crash when loading json (#145) * nil section header labels are now replaced with empty string avoiding a crash * label check now checks against section (not _sections) --- RNTableView/RNTableView.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/RNTableView/RNTableView.m b/RNTableView/RNTableView.m index 9d98bef..241debf 100644 --- a/RNTableView/RNTableView.m +++ b/RNTableView/RNTableView.m @@ -36,7 +36,7 @@ @implementation RNTableView { - (void)setEditing:(BOOL)editing { _editing = editing; - + [self.tableView setEditing:editing animated:YES]; } @@ -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;