if ([database_ era] != era_)
return nil;
- return [sources_ objectAtIndex:[indexPath row]];
+ NSUInteger index([indexPath row]);
+ return index < [sources_ count] ? [sources_ objectAtIndex:index] : nil;
} }
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
Source *source = [self sourceAtIndexPath:indexPath];
+ if (source == nil) return;
SourceController *controller = [[[SourceController alloc]
initWithDatabase:database_
- (void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
Source *source = [self sourceAtIndexPath:indexPath];
+ if (source == nil) return;
+
[Sources_ removeObjectForKey:[source key]];
[delegate_ _saveConfig];
[delegate_ reloadDataWithInvocation:nil];