summaryrefslogtreecommitdiff
path: root/rbutil
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2008-02-02 21:34:39 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2008-02-02 21:34:39 +0000
commit91a503b23e54e1f58ec3756cb21e2dd90e1763a0 (patch)
treeed6bf2db56c311a6a37099fbe7b58fbd7a3fcbea /rbutil
parent51f6fb56f143107fce78fb98b0328ded59bc4710 (diff)
Don't segfault upon opening the voice / talk creation window if the encoder setting is missing. This could happen if the configuration file is older and the user didn't re-save the settings.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16202 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil')
-rw-r--r--rbutil/rbutilqt/createvoicewindow.cpp19
-rw-r--r--rbutil/rbutilqt/installtalkwindow.cpp17
2 files changed, 24 insertions, 12 deletions
diff --git a/rbutil/rbutilqt/createvoicewindow.cpp b/rbutil/rbutilqt/createvoicewindow.cpp
index dda0097b5e..8e08ba3f28 100644
--- a/rbutil/rbutilqt/createvoicewindow.cpp
+++ b/rbutil/rbutilqt/createvoicewindow.cpp
@@ -87,15 +87,20 @@ void CreateVoiceWindow::setSettings(RbSettings* sett)
ui.labelTtsProfile->setText(tr("Selected TTS Engine: <b>%1</b>").arg("Invalid TTS configuration!"));
QString encoder = settings->curEncoder();
- EncBase* enc = getEncoder(encoder);
- enc->setCfg(settings);
- if(enc->configOk())
- ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg(encoder));
+ // only proceed if encoder setting is set
+ if(!encoder.isEmpty()) {
+ // FIXME: getEncoder CAN return a NULL pointer. Additional error
+ // checking is required or getEncoder should use the default engine
+ EncBase* enc = getEncoder(encoder);
+ enc->setCfg(settings);
+ if(enc->configOk())
+ ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg(encoder));
+ else
+ ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg("Invalid encoder configuration!"));
+ }
else
ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg("Invalid encoder configuration!"));
-
- ui.wavtrimthreshold->setValue(settings->wavtrimTh());
-
+ ui.wavtrimthreshold->setValue(settings->wavtrimTh());
}
diff --git a/rbutil/rbutilqt/installtalkwindow.cpp b/rbutil/rbutilqt/installtalkwindow.cpp
index f7202aae40..dfe2a84c19 100644
--- a/rbutil/rbutilqt/installtalkwindow.cpp
+++ b/rbutil/rbutilqt/installtalkwindow.cpp
@@ -119,13 +119,20 @@ void InstallTalkWindow::setSettings(RbSettings* sett)
ui.labelTtsProfile->setText(tr("Selected TTS Engine: <b>%1</b>").arg("Invalid TTS configuration!"));
QString encoder = settings->curEncoder();
- EncBase* enc = getEncoder(encoder);
- enc->setCfg(settings);
- if(enc->configOk())
- ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg(encoder));
+ // only proceed if encoder setting is set
+ if(!encoder.isEmpty()) {
+ // FIXME: getEncoder CAN return a NULL pointer. Additional error
+ // checking is required or getEncoder should use the default engine
+ EncBase* enc = getEncoder(encoder);
+ enc->setCfg(settings);
+ if(enc->configOk())
+ ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg(encoder));
+ else
+ ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg("Invalid encoder configuration!"));
+ }
else
ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg("Invalid encoder configuration!"));
-
+
setTalkFolder(settings->lastTalkedFolder());
}