mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Fix remainingPlaybackAnimationMs crash (#7836)
This happens when trying to round `Float.NaN` to `Int`
This commit is contained in:
committed by
GitHub
parent
558c4541cd
commit
a12977b4dc
+4
-2
@@ -152,8 +152,10 @@ internal fun remainingPlaybackAnimationMs(
|
||||
durationMs: Long,
|
||||
playbackSpeed: Float,
|
||||
): Int {
|
||||
val remainingProgress = (1f - progress).coerceAtLeast(0f)
|
||||
return (remainingProgress * durationMs / playbackSpeed.coerceAtLeast(0.01f))
|
||||
if (!progress.isFinite() || !playbackSpeed.isFinite() || durationMs <= 0L) return 0
|
||||
val remainingProgress = (1f - progress).coerceIn(0f, 1f)
|
||||
val speed = playbackSpeed.coerceAtLeast(0.01f)
|
||||
return (remainingProgress * durationMs / speed)
|
||||
.roundToInt()
|
||||
.coerceAtLeast(0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user