if (![[array objectAtIndex:indexPath.row] isEmpty]) {
.... proceed as necessary
}
indexPath.row could hold any type of object or it could be empty. Often it is empty and thus it chokes when attempting to retrieve the object at specified location when it’s null. I have tried the above approach but that doesn’t work either. What is the correct way to check for this scenario?
You should not be calling
objectAtIndex:without knowing if the array contains object at an index. Instead you should check,And if you are using the
arrayas the data source for tableView. You should simply return[array count]as number of rows,And, just get the object at indexPath.row without checking any conditions.