summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/createvoicewindow.cpp
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/rbutilqt/createvoicewindow.cpp
parent51f6fb56f143107fce78fb98b0328ded59bc4710 (diff)
downloadrockbox-91a503b23e54e1f58ec3756cb21e2dd90e1763a0.tar.gz
rockbox-91a503b23e54e1f58ec3756cb21e2dd90e1763a0.tar.bz2
rockbox-91a503b23e54e1f58ec3756cb21e2dd90e1763a0.zip
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/rbutilqt/createvoicewindow.cpp')
-rw-r--r--rbutil/rbutilqt/createvoicewindow.cpp19
1 files changed, 12 insertions, 7 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());
}