fix: Fallback to 0 amplitude on error; Closes #14

This commit is contained in:
Myzel394 2023-08-17 11:30:07 +02:00
parent 8bd9e3d35a
commit d87c7a182e
No known key found for this signature in database
GPG Key ID: 50098FCA22080F0F

View File

@ -73,5 +73,11 @@ class AudioRecorderService: IntervalRecorderService() {
override fun getAmplitudeAmount(): Int = amplitudesAmount
override fun getAmplitude(): Int = recorder?.maxAmplitude ?: 0
override fun getAmplitude(): Int {
return try {
recorder!!.maxAmplitude
} catch (error: IllegalStateException) {
0
}
}
}