Skip to content

Commit

Permalink
PT11523934. Fix for crash in BrowseViewController
Browse files Browse the repository at this point in the history
  • Loading branch information
willspurgeon-wayfair committed Oct 18, 2017
1 parent 48846ee commit 5e21936
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Source/Layout/BrickFlowLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,13 @@ open class BrickFlowLayout: UICollectionViewLayout, BrickLayout {

var updated = false
for section in currentSections {
// For deletion cases, we don't want to recalculate brick layaout sections for indexes
// that no longer exist in the collection view.
let sectionCount = _collectionView.numberOfItems(inSection: section.sectionIndex)
updateSection(section, updatedAttributes: updateAttributes, action: {
updated = section.continueCalculatingCells() || updated
if section.numberOfItems <= sectionCount {
updated = section.continueCalculatingCells() || updated
}
})
}

Expand Down

0 comments on commit 5e21936

Please sign in to comment.