Skip to content

Commit

Permalink
Merge pull request arturgrigor#2 from chintan100/master
Browse files Browse the repository at this point in the history
Minor bug fix to prevent crash
  • Loading branch information
arturgrigor committed May 9, 2012
2 parents 99aca00 + fefbdec commit d6cae61
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion AGImagePickerController/AGIPCAssetsController.m
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,12 @@ - (void)reloadData
[self changeSelectionInformation];

NSInteger totalRows = [self.tableView numberOfRowsInSection:0];
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:totalRows-1 inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:NO];

//Prevents crash if totalRows = 0 (when the album is empty).
if (totalRows > 0) {

[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:totalRows-1 inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:NO];
}
}

- (void)doneAction:(id)sender
Expand Down

0 comments on commit d6cae61

Please sign in to comment.