kunfei 4 lat temu
rodzic
commit
bd4fff0841

+ 3 - 1
app/src/main/java/io/legado/app/service/TTSReadAloudService.kt

@@ -79,7 +79,9 @@ class TTSReadAloudService : BaseReadAloudService(), TextToSpeech.OnInitListener
                 val tts = textToSpeech ?: throw NoStackTraceException("tts is null")
                 val tts = textToSpeech ?: throw NoStackTraceException("tts is null")
                 var result = tts.speak("", TextToSpeech.QUEUE_FLUSH, null, null)
                 var result = tts.speak("", TextToSpeech.QUEUE_FLUSH, null, null)
                 if (result == TextToSpeech.ERROR) {
                 if (result == TextToSpeech.ERROR) {
-                    throw NoStackTraceException("朗读出错:空")
+                    clearTTS()
+                    initTts()
+                    return
                 }
                 }
                 for (i in nowSpeak until contentList.size) {
                 for (i in nowSpeak until contentList.size) {
                     val text = contentList[i].replace(AppPattern.notReadAloudRegex, "")
                     val text = contentList[i].replace(AppPattern.notReadAloudRegex, "")