From d8e2707ac017d367aa02a778a050e7a9894e0b16 Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Thu, 5 Jun 2014 22:41:28 -0400 Subject: [PATCH] Fixed crash when scrolling to first element of transient site. [FIXED] The first cell of the transient site isn't a Delete button, this caused a crash due to it being rendered with an unexpected type. --- MasterPassword/ObjC/iOS/MPPasswordTypesCell.m | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/MasterPassword/ObjC/iOS/MPPasswordTypesCell.m b/MasterPassword/ObjC/iOS/MPPasswordTypesCell.m index b6e85430..472a6d24 100644 --- a/MasterPassword/ObjC/iOS/MPPasswordTypesCell.m +++ b/MasterPassword/ObjC/iOS/MPPasswordTypesCell.m @@ -99,18 +99,20 @@ - (MPPasswordLargeCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { MPPasswordLargeCell *cell; - if (indexPath.item == 0) + if (!self.transientSite && indexPath.item == 0) { cell = [MPPasswordLargeDeleteCell dequeueCellFromCollectionView:collectionView atIndexPath:indexPath]; - else + [cell updateWithElement:self.mainElement]; + } else { cell = [MPPasswordLargeCell dequeueCellWithType:[self typeForContentIndexPath:indexPath] fromCollectionView:collectionView atIndexPath:indexPath]; - [cell prepareForReuse]; + [cell prepareForReuse]; - if (self.transientSite) - [cell updateWithTransientSite:self.transientSite]; - else - [cell updateWithElement:self.mainElement]; + if (self.transientSite) + [cell updateWithTransientSite:self.transientSite]; + else + [cell updateWithElement:self.mainElement]; + } if (_scrolling) [cell willBeginDragging];