From cf3e27a25dc225fbf0b422db25bfcda579c46372 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 18 Feb 2021 18:16:12 +0100 Subject: [PATCH] adding a crashfix with zero division --- .../simplemobiletools/gallery/pro/views/MediaSideScroll.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MediaSideScroll.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MediaSideScroll.kt index 61ff895a0..dcb8793bd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MediaSideScroll.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MediaSideScroll.kt @@ -156,6 +156,10 @@ class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(co val stream = AudioManager.STREAM_MUSIC val maxVolume = activity!!.audioManager.getStreamMaxVolume(stream) val percentPerPoint = 100 / maxVolume + if (percentPerPoint == 0) { + return + } + val addPoints = percent / percentPerPoint val newVolume = Math.min(maxVolume, Math.max(0, mTouchDownValue + addPoints)) activity!!.audioManager.setStreamVolume(stream, newVolume, 0)