summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Juick/ViewControllers/MessagesViewController.m4
1 files changed, 2 insertions, 2 deletions
diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m
index aae1593..fb3f63b 100644
--- a/Juick/ViewControllers/MessagesViewController.m
+++ b/Juick/ViewControllers/MessagesViewController.m
@@ -87,8 +87,8 @@ NSString* const messageCellIdentifier = @"messageCell";
if (self.shouldScrollToUnreadOnRefresh) {
NSInteger messagesCount = [self.messages count];
if (messagesCount > 0) {
- NSInteger itemToScroll = [self.firstUnread integerValue] ? : self.messages.count - 1;
- NSIndexPath *lastRow = [NSIndexPath indexPathForRow:MIN(itemToScroll, messagesCount - 1) inSection:0];
+ NSInteger itemToScroll = MIN([self.firstUnread integerValue], self.messages.count - 1);
+ NSIndexPath *lastRow = [NSIndexPath indexPathForRow:itemToScroll inSection:0];
[self.tableView scrollToRowAtIndexPath:lastRow atScrollPosition:UITableViewScrollPositionBottom animated:NO];
}
self.firstUnread = nil;