diff options
Diffstat (limited to 'src/plugins/tts/sapi/qtexttospeech_sapi.cpp')
-rw-r--r-- | src/plugins/tts/sapi/qtexttospeech_sapi.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/tts/sapi/qtexttospeech_sapi.cpp b/src/plugins/tts/sapi/qtexttospeech_sapi.cpp index 67d81ea..8def2f8 100644 --- a/src/plugins/tts/sapi/qtexttospeech_sapi.cpp +++ b/src/plugins/tts/sapi/qtexttospeech_sapi.cpp @@ -563,8 +563,10 @@ HRESULT QTextToSpeechEngineSapi::NotifyCallback(WPARAM /*wParam*/, LPARAM /*lPar m_state = QTextToSpeech::Ready; break; case SPEI_WORD_BOUNDARY: - emit sayingWord(currentText.sliced(event.lParam, event.wParam), - event.lParam - textOffset, event.wParam); + if (qsizetype(event.lParam + event.wParam) <= currentText.size()) { + emit sayingWord(currentText.sliced(event.lParam, event.wParam), + event.lParam - textOffset, event.wParam); + } break; // these are the other TTS events which might be interesting for us at some point case SPEI_SENTENCE_BOUNDARY: |