Protect TimelineItemAspectRatioBox against Float.NaN (#1201)
* Protect `TimelineItemAspectRatioBox` against infinite values.
This commit is contained in:
parent
c0a4ca16a2
commit
47a0ecb3b8
2 changed files with 4 additions and 1 deletions
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() }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue