From 2a34d6eb8b224a62238254b2ad12069c744355e1 Mon Sep 17 00:00:00 2001 From: tarsin Date: Fri, 26 May 2023 15:13:45 +0800 Subject: [PATCH] Workaround aspect is NaN, Resolve #1116 --- .../java/com/hippo/ehviewer/ui/compose/data/GalleryInfo.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 6649e3cf0..07e7a26aa 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,7 +129,8 @@ fun GalleryInfoGridItem( info: GalleryInfo, modifier: Modifier = Modifier, ) { - val aspect = (info.thumbWidth.toFloat() / info.thumbHeight).coerceIn(0.33F, 1.5F) + var aspect = (info.thumbWidth.toFloat() / info.thumbHeight).coerceIn(0.33F, 1.5F) + if (aspect.isNaN()) aspect = 1F val color = EhUtils.getCategoryColor(info.category) val simpleLang = info.simpleLanguage ElevatedCard(