diff options
author | Vitaly Takmazov | 2019-03-26 10:27:45 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2019-03-26 10:27:45 +0300 |
commit | 38f90aa20adfa5fc346dda3cc151fa68bf2f6a5d (patch) | |
tree | 426423f236c069cc6878f0543cb857ec7efef829 /Juick/ViewControllers/ChatViewController.m | |
parent | 4efd5ac3d91c5880c5acab78d01a003ad6bbcd86 (diff) |
Fix crashes
Diffstat (limited to 'Juick/ViewControllers/ChatViewController.m')
-rw-r--r-- | Juick/ViewControllers/ChatViewController.m | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Juick/ViewControllers/ChatViewController.m b/Juick/ViewControllers/ChatViewController.m index a76cc00..0de3d2a 100644 --- a/Juick/ViewControllers/ChatViewController.m +++ b/Juick/ViewControllers/ChatViewController.m @@ -47,7 +47,10 @@ [self.tableView beginUpdates]; [self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:YES]; [self.tableView endUpdates]; - [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:[self.messages count]-1 inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:NO]; + NSInteger messagesCount = [self.messages count]; + if (messagesCount > 0) { + [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:[self.messages count]-1 inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:NO]; + } } [self.refreshControl endRefreshing]; }]; |