From ee0a29fa9c83033de36076ca992bdc16f29d0716 Mon Sep 17 00:00:00 2001 From: Mike Amaral Date: Tue, 6 Jan 2015 11:49:46 -0500 Subject: [PATCH] If the groups mutable array is emptied at some point before cellForRowAtIndexPath is called, this can cause a crash. --- UzysAssetsPickerController/Library/UzysGroupPickerView.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/UzysAssetsPickerController/Library/UzysGroupPickerView.m b/UzysAssetsPickerController/Library/UzysGroupPickerView.m index 4a66622..6e6fa9d 100644 --- a/UzysAssetsPickerController/Library/UzysGroupPickerView.m +++ b/UzysAssetsPickerController/Library/UzysGroupPickerView.m @@ -117,7 +117,11 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N { cell = [[UzysGroupViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; } - [cell applyData:[self.groups objectAtIndex:indexPath.row]]; + + if (self.groups.count > 0) { + [cell applyData:[self.groups objectAtIndex:indexPath.row]]; + } + return cell; }