From 6ceb9b2dbcdfce52e856c8aceb9602c1285e3f5f Mon Sep 17 00:00:00 2001 From: Boris Safonov Date: Tue, 17 Dec 2024 17:03:58 +0200 Subject: [PATCH] Review updates --- .../android/media/audiomessage/AudioWavesMaskHelper.kt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) 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() {