Skip to content

Commit f40dcfa

Browse files
committed
Catch recorder.stop exception
1 parent b90e10d commit f40dcfa

File tree

1 file changed

+6
-1
lines changed
  • firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type

1 file changed

+6
-1
lines changed

firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/AudioHelper.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,12 @@ internal class AudioHelper(
105105
fun pauseRecording() {
106106
if (released || recorder.recordingState == AudioRecord.RECORDSTATE_STOPPED) return
107107

108-
recorder.stop()
108+
try {
109+
recorder.stop()
110+
} catch (e: IllegalStateException) {
111+
release()
112+
throw IllegalStateException("The playback track was not properly initialized.")
113+
}
109114
}
110115

111116
/**

0 commit comments

Comments
 (0)