From f92ce637bfd3b38ffd9c1aab83ec34e1afa480e9 Mon Sep 17 00:00:00 2001 From: tarsin Date: Fri, 26 May 2023 15:22:50 +0800 Subject: [PATCH] Fixup unsafe Composable behaviour --- .../java/com/hippo/ehviewer/ui/compose/data/GalleryInfo.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/main/java/com/hippo/ehviewer/ui/compose/data/GalleryInfo.kt b/app/src/main/java/com/hippo/ehviewer/ui/compose/data/GalleryInfo.kt index 07e7a26aa..4ad0e5d46 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/compose/data/GalleryInfo.kt +++ b/app/src/main/java/com/hippo/ehviewer/ui/compose/data/GalleryInfo.kt @@ -129,8 +129,7 @@ fun GalleryInfoGridItem( info: GalleryInfo, modifier: Modifier = Modifier, ) { - var aspect = (info.thumbWidth.toFloat() / info.thumbHeight).coerceIn(0.33F, 1.5F) - if (aspect.isNaN()) aspect = 1F + val aspect = (info.thumbWidth.toFloat() / info.thumbHeight).coerceIn(0.33F, 1.5F).takeUnless { it.isNaN() } ?: 1F val color = EhUtils.getCategoryColor(info.category) val simpleLang = info.simpleLanguage ElevatedCard(