Question: I have a dynamic populated list. I am trying to have it return nothing if a variable is a certain value.

Here is what I am doing:

```
/* FIRST VALIDATE TIME LEFT TO MAKE SURE IT STILL EXIST */
    NSString *check = [self.googlePlacesArrayFromAFNetworking[indexPath.row] objectForKey:@"time_left"];
    if(![check isEqualToString:@"expired"])
    {
        return cell;
    }
    else
    {
        return NULL;
    }

```

Now if `expired` exist than it returns `NULL` but that does not work. It crashes with the following error: 

`'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'`

Not sure how I can fix this, suggestions and thoughts?

David

UPDATE:

`cell`:

```
static NSString *CellIdentifier = @"timelineCell";
    FBGTimelineCell *cell = (FBGTimelineCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    cell = [[FBGTimelineCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    [cell initTimelineCell];

```

Answer: 
It depends on what you want. There are two options:

1. If you want your table view to have empty rows for the data that are expired, you need to configure and return a blank cell.
2. If you want those cells to be missing, you need to return the correct number of rows for `-tableView:numberOfRowsInSection` (that is, subtract out the number of expired rows in your calculations before returning from that method). Then, your data source will never be asked for a cell for that index path.

**Update:** by the way, you should return `nil`, not `NULL`, when the parameter is expecting an Objective-C object. `nil` is equivalent to (id)0, whereas `NULL` is equivalent to `(void *)0`. [[source](http://nshipster.com/nil/)]
You always have to return a `cell`. What you need is not return `nil` but just don't populate it.