Skip to content

Commit 720ca82

Browse files
committed
Close TextToSpeech gracefully in its constructor
1 parent a25e80b commit 720ca82

File tree

1 file changed

+3
-2
lines changed
  • app-base/src/main/java/xyz/aprildown/timer/app/base/media

1 file changed

+3
-2
lines changed

app-base/src/main/java/xyz/aprildown/timer/app/base/media/TtsSpeaker.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,9 @@ private class WelcomingTextToSpeech(
260260

261261
override fun onInit(status: Int) {
262262
if (status != TextToSpeech.SUCCESS) {
263-
stop()
264-
HandlerHelper.runOnUiThread {
263+
// onInit may be called in the constructor of TextToSpeech
264+
HandlerHelper.post {
265+
stop()
265266
listener.onError(status)
266267
}
267268
return

0 commit comments

Comments
 (0)