fix: NumberFormatException

This commit is contained in:
junkfood
2026-02-01 20:47:47 +08:00
parent 52c2ab478d
commit 46841aca53

View File

@@ -191,12 +191,12 @@ internal class ImageCandidates(val baseUrl: String, val srcSet: String, val absS
val descriptor = candidate.last()
when {
descriptor.endsWith("w", ignoreCase = true) -> {
descriptor.substringBefore("w").toFloat() /
(descriptor.substringBefore("w").toFloatOrNull() ?: return@fold acc) /
maxSize.width.pxOrElse { 1 }
}
descriptor.endsWith("x", ignoreCase = true) -> {
descriptor.substringBefore("x").toFloat() / pixelDensity
(descriptor.substringBefore("x").toFloatOrNull() ?: return@fold acc) / pixelDensity
}
else -> {