From 6c7a977ca6a3ca5495fdb4ea22d19973f77bea4a Mon Sep 17 00:00:00 2001 From: arturdev Date: Sat, 5 Jul 2014 00:04:53 +0400 Subject: [PATCH] Fixed #13 --- SOMessaging/SOMessagingViewController.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/SOMessaging/SOMessagingViewController.m b/SOMessaging/SOMessagingViewController.m index bc12ec3..bd02e10 100644 --- a/SOMessaging/SOMessagingViewController.m +++ b/SOMessaging/SOMessagingViewController.m @@ -375,10 +375,12 @@ - (void)refreshMessages [self.tableView reloadData]; NSInteger section = [self.tableView numberOfSections] - 1; - NSInteger row = [self.tableView numberOfRowsInSection:section] - 1; - NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:section]; - if (row >= 0) { - [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES]; + if (section > 0) { + NSInteger row = [self.tableView numberOfRowsInSection:section] - 1; + NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:section]; + if (row >= 0) { + [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES]; + } } }