From 45aee103c3470feef56fdbf308dca914db879320 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 22 Dec 2022 13:36:39 +0300 Subject: Range check on messages array --- Juick/ViewControllers/MessagesViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Juick') diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m index fb3f63b..804b47b 100644 --- a/Juick/ViewControllers/MessagesViewController.m +++ b/Juick/ViewControllers/MessagesViewController.m @@ -148,7 +148,7 @@ NSString* const messageCellIdentifier = @"messageCell"; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - if (self.dataLoading && self.messages.count == 0) { + if ((self.dataLoading && self.messages.count == 0) || indexPath.row >= self.messages.count) { return [tableView dequeueReusableCellWithIdentifier:@"contentLoadingCell"]; } else { Message *msg = [self.messages objectAtIndex:indexPath.row]; -- cgit v1.2.3