mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Protect TimelineItemAspectRatioBox against Float.NaN (#1201)
* Protect `TimelineItemAspectRatioBox` against infinite values.
This commit is contained in:
committed by
GitHub
parent
c0a4ca16a2
commit
47a0ecb3b8
+3
-1
@@ -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