forked from len0rd/rockbox
Don't assume success for TTS object creation.
While the current implementation of getTTS() will always return an object this might change later. Check the returned object before using it to be on the safe side. Change-Id: Ic949cae7cfbe6f3086dee6aab741b0acafe14640
This commit is contained in:
parent
a2dd1625bc
commit
7f76bb48b3
4 changed files with 41 additions and 5 deletions
|
|
@ -418,6 +418,13 @@ void Config::updateTtsState(int index)
|
|||
QString ttsName = ui.comboTts->itemData(index).toString();
|
||||
TTSBase* tts = TTSBase::getTTS(this,ttsName);
|
||||
|
||||
if(!tts)
|
||||
{
|
||||
QMessageBox::critical(this, tr("TTS error"),
|
||||
tr("The selected TTS failed to initialize. You can't use this TTS."));
|
||||
return;
|
||||
}
|
||||
|
||||
if(tts->configOk())
|
||||
{
|
||||
ui.configTTSstatus->setText(tr("Configuration OK"));
|
||||
|
|
@ -837,9 +844,14 @@ void Config::testTts()
|
|||
QString errstr;
|
||||
int index = ui.comboTts->currentIndex();
|
||||
TTSBase* tts;
|
||||
|
||||
ui.testTTS->setEnabled(false);
|
||||
tts = TTSBase::getTTS(this,ui.comboTts->itemData(index).toString());
|
||||
if(!tts)
|
||||
{
|
||||
QMessageBox::critical(this, tr("TTS error"),
|
||||
tr("The selected TTS failed to initialize. You can't use this TTS."));
|
||||
return;
|
||||
}
|
||||
ui.testTTS->setEnabled(false);
|
||||
if(!tts->configOk())
|
||||
{
|
||||
QMessageBox::warning(this,tr("TTS configuration invalid"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue