diff --git a/vector/src/main/java/im/vector/app/features/voice/VoiceRecorderL.kt b/vector/src/main/java/im/vector/app/features/voice/VoiceRecorderL.kt index 69de911d60..8816ffafbd 100644 --- a/vector/src/main/java/im/vector/app/features/voice/VoiceRecorderL.kt +++ b/vector/src/main/java/im/vector/app/features/voice/VoiceRecorderL.kt @@ -118,12 +118,13 @@ class VoiceRecorderL( } override fun stopRecord() { + val recorder = this.audioRecorder ?: return recordingJob?.cancel() - if (audioRecorder?.state == AudioRecord.STATE_INITIALIZED) { - audioRecorder?.stop() + if (recorder.state == AudioRecord.STATE_INITIALIZED) { + recorder.stop() } - audioRecorder?.release() + recorder.release() audioRecorder = null noiseSuppressor?.release()