title: Getting 'index 0 beyond bounds for empty array' error on non-empty array
body: <p>I have this code to add a row to a table view in the root view controller of my application:</p>
  
  <pre><code>NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
  
  NSArray *myArray = [NSArray arrayWithObject:indexPath];
  
  NSLog(@"count:%d", [myArray count]);
  
  [self.tableView insertRowsAtIndexPaths:myArray withRowAnimation:UITableViewRowAnimationFade];
  
  [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
  </code></pre>
  
  <p>When it is run with the simulator I get this output:</p>
  
  <blockquote>
    <p>count:1<br>
    <strong>* Terminating app due to uncaught exception 'NSRangeException', reason: '*</strong> -[NSMutableArray objectAtIndex:]: index 0 beyond bounds for empty array'</p>
  </blockquote>
  
  <p>This is occurring at the <code>[self.tableView insertRowsAtIndexPaths:myArray withRowAnimation:UITableViewRowAnimationFade];</code> line, but the <code>NSLog</code> statement shows that the <code>NSArray</code> called <code>myArray</code> is not empty.  Am I missing something?  Has anyone ever encountered this before?</p>