Skip to content

Commit

Permalink
Using firstOrNull instead of first in UIViewLazyList to prevent throw…
Browse files Browse the repository at this point in the history
…ing errors

Follow-up to #2250
  • Loading branch information
dnagler committed Aug 19, 2024
1 parent 6d37ac7 commit 958d1d0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -312,15 +312,15 @@ internal class LazyListContainerCell(

if (contentView.subviews.isEmpty()) return

val content = contentView.subviews.first() as UIView ?: return
val content = contentView.subviews.firstOrNull() as UIView ?: return
content.setFrame(bounds)
contentView.setFrame(bounds)
}

override fun sizeThatFits(size: CValue<CGSize>): CValue<CGSize> {
if (contentView.subviews.isEmpty()) return super.sizeThatFits(size)

val content = contentView.subviews.first() as UIView ?: return super.sizeThatFits(size)
val content = contentView.subviews.firstOrNull() as UIView ?: return super.sizeThatFits(size)
return content.sizeThatFits(size)
}

Expand Down

0 comments on commit 958d1d0

Please sign in to comment.