Protect TimelineItemAspectRatioBox against Float.NaN (#1201)
* Protect `TimelineItemAspectRatioBox` against infinite values.
This commit is contained in:
committed by
GitHub
parent
e7cf36e2f9
commit
1c4eb45a60
1
changelog.d/1995.bugfix
Normal file
1
changelog.d/1995.bugfix
Normal file
@@ -0,0 +1 @@
|
||||
Crash with `aspectRatio` modifier when `Float.NaN` was used as input.
|
||||
@@ -132,10 +132,12 @@ class TimelineItemContentMessageFactory @Inject constructor(
|
||||
}
|
||||
|
||||
private fun aspectRatioOf(width: Long?, height: Long?): Float? {
|
||||
return if (height != null && width != null) {
|
||||
val result = if (height != null && width != null) {
|
||||
width.toFloat() / height.toFloat()
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
return result?.takeIf { it.isFinite() }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user