Q:

NSMutableArray out of bounds error

I have this part of a method that is giving me an error.
This is a word filter, user types a, all words come up, etc...
Error comes when user deletes the searchbar text, and clicks something on the table, I get out of bounds exception.
The print out for filteredListContent is a single "" entry, what should I implement from keeping the "" from crashing the program?
Thanks
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    if ([_filteredListContent count]>0){
        NSLog(@"%i",indexPath.row);
        NSLog(@"%@",_filteredListContent);
        _searchBar.text=[self.filteredListContent objectAtIndex:indexPath.row];
        //Save to user default

A:

I'm not sure what is causing your problem but from the code given it looks like the row selected is "out of bounds". I would change my check:
[_filteredListContent count] > 0

to something like:
[_filteredListContent count] > indexPath.row

Again this is just based on the code given.

