diff --git a/app/src/main/kotlin/com/wire/android/media/audiomessage/AudioWavesMaskHelper.kt b/app/src/main/kotlin/com/wire/android/media/audiomessage/AudioWavesMaskHelper.kt index dd5ef24540..c4bc1df831 100644 --- a/app/src/main/kotlin/com/wire/android/media/audiomessage/AudioWavesMaskHelper.kt +++ b/app/src/main/kotlin/com/wire/android/media/audiomessage/AudioWavesMaskHelper.kt @@ -66,13 +66,8 @@ class AudioWavesMaskHelper @Inject constructor( } private fun List.averageInt(): Double { - var sum = 0.0 - var count = 0 - for (element in this) { - sum += element - ++count - } - return if (count == 0) 0.0 else sum / count + if (isEmpty()) return 0.0 + return sum().toDouble() / size } fun clear() {