Fix(tts): check if done channel is closed or not

This commit is contained in:
Grail Finder
2026-01-13 12:00:32 +03:00
parent 05a2098e02
commit f57334b170

View File

@@ -110,7 +110,13 @@ func (o *KokoroOrator) stoproutine() {
<-TTSTextChan
}
o.textBuffer.Reset()
o.currentDone <- true
if o.currentDone != nil {
select {
case o.currentDone <- true:
default:
// Channel might be closed, ignore
}
}
o.interrupt = true
}
}
@@ -317,7 +323,13 @@ func (o *GoogleTranslateOrator) stoproutine() {
<-TTSTextChan
}
o.textBuffer.Reset()
o.currentDone <- true
if o.currentDone != nil {
select {
case o.currentDone <- true:
default:
// Channel might be closed, ignore
}
}
o.interrupt = true
}
}