fix: NaN aspect ratio can cause crash

Signed-off-by: Infi <infi@infi.sh>
This commit is contained in:
Infi 2024-10-28 02:07:24 +01:00
parent 6447bf6ffe
commit 1b476ed7de
1 changed files with 3 additions and 1 deletions

View File

@ -125,7 +125,9 @@ fun RegularEmbed(
}
)
.aspectRatio(
(it.width?.toFloat() ?: 0f) / (it.height?.toFloat() ?: 0f)
((it.width?.toFloat() ?: 0f) / (it.height?.toFloat() ?: 0f)).let {
if (it.isNaN()) 1f else it
}
),
contentScale = ContentScale.Crop,
description = null // decorative