title: UITableViewController [__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array' with PFTask thenCallBackOnMainThreadAsync:]
body: <p>I am purposely creating a empty Array to not display anything on the UITablewView.</p>
  
  <p>However, it gives me that error.</p>
  
  <p>To debug, I even created an empty UITableViewController and refer storyboard file to this. However, it is giving me the same error. </p>
  
  <p>I just tried and connect it with an empty UIViewController, it is giving me the same objectAtIndex error.</p>
  
  <p>So I doubt it is the problem with the what I am indexing for cells.</p>
  
  <p>When I run, the screen is shown but it throws the error and it freezes.</p>
  
  <p>The declaration of the newsList is:</p>
  
  <p><code>@property (strong, nonatomic)NSArray *newsList</code></p>
  
  <p>This is what I have for the UITableViewController.</p>
  
  <pre><code>- (void)viewWillAppear:(BOOL)animated
  {
  
      [super viewWillAppear:animated];
  
      self.currentUser = appDelegate.currentUser;
  
      NSString *addNewsFeed = @"_NewsFeed";
  
  
      if (self.currentUser)
      {
  
  
          if (appDelegate.selectedGroup == nil)
          {
              self.newsList = nil;
  
  
          }
          else
          {
              NSLog(@"SELECTED GROUP EXIST");
              NSString *currentNewsFeed = [appDelegate.selectedGroup[@"name"] stringByAppendingString:addNewsFeed];
  
              PFQuery *query = [PFQuery queryWithClassName:currentNewsFeed];
              [query orderByDescending:@"createdAt"];
  
              [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
  
                  if (error)
                  {
                      NSLog(@"Error: %@, %@", error, [error userInfo]);
                  }
                  else
                  {
                      self.newsList = objects;
                      [self.tableView reloadData];
                  }
              }];
          }
  
  
  
      }
      else
      {
          NSLog(@"%@", appDelegate.currentUser);
          [self performSegueWithIdentifier:@"loginView" sender:self];
  
      }
  
      NSLog(@"ZXCVZCVZ: %@", self.newsList);
  
  
  
  }
  
  - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  {
      if (appDelegate.selectedGroup == nil)
      {
          NSLog(@"NO CELL HERE");
  
          return 0;
      }
  
      return 1;
  }
  
  - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  {
      if (appDelegate.selectedGroup == nil)
      {
          NSLog(@"NO CELL");
          return 0;
      }
  
      return [self.newsList count];
  }
  
  
  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
  
      NSLog(@"NO LIST FOUND");
      static NSString *CellIdentifier = @"News";
      NSLog(@"DSFSDFSDFSFS");
      UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
      PFObject *item = [self.newsList objectAtIndex:indexPath.row];
      cell.textLabel.text = item[@"title"];
      cell.detailTextLabel.text = item[@"news"];
  
      return cell;
  
  
  
  }
  </code></pre>