Skip to content

Commit e0bf7f2

Browse files
authored
Solution for iPad crash on iOS 15 from mischa-hildebrand#35 (comment)
1 parent 49330ef commit e0bf7f2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

AlignedCollectionViewFlowLayout/Classes/AlignedCollectionViewFlowLayout.swift

+6-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,12 @@ open class AlignedCollectionViewFlowLayout: UICollectionViewFlowLayout {
286286
var lineFrame = layoutAttributes.frame
287287
lineFrame.origin.x = sectionInset.left
288288
lineFrame.size.width = lineWidth
289-
return super.layoutAttributesForElements(in: lineFrame) ?? []
289+
let result = super.layoutAttributesForElements(in: lineFrame)
290+
if let result = result, !result.isEmpty {
291+
return result
292+
} else {
293+
return [UICollectionViewLayoutAttributes()]
294+
}
290295
}
291296

292297
/// Copmutes the alignment axis with which to align the items represented by the `layoutAttributes` objects vertically.

0 commit comments

Comments
 (0)