summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-09-22 18:23:54 +0100
committerCarl Hetherington <cth@carlh.net>2012-09-22 18:23:54 +0100
commit2367db77c5ad7e4c2319351bcc9c09b7fc387384 (patch)
tree6ea1ad4a22f492818eb2b3710f61c4ac5bc48c7b /src
parent7333d9ee1ff505cbd635cbca23c83656a705a4a4 (diff)
Fix crash on OK-ing gain calculation dialog without entering anything.
Diffstat (limited to 'src')
-rw-r--r--src/wx/film_editor.cc6
-rw-r--r--src/wx/gain_calculator_dialog.cc8
2 files changed, 14 insertions, 0 deletions
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc
index c8ef0f233..71c48bd79 100644
--- a/src/wx/film_editor.cc
+++ b/src/wx/film_editor.cc
@@ -648,6 +648,12 @@ FilmEditor::audio_gain_calculate_button_clicked (wxCommandEvent &)
{
GainCalculatorDialog* d = new GainCalculatorDialog (this);
d->ShowModal ();
+
+ if (d->wanted_fader() == 0 || d->actual_fader() == 0) {
+ d->Destroy ();
+ return;
+ }
+
_audio_gain->SetValue (
Config::instance()->sound_processor()->db_for_fader_change (
d->wanted_fader (),
diff --git a/src/wx/gain_calculator_dialog.cc b/src/wx/gain_calculator_dialog.cc
index fcd54d4cf..3f07faf06 100644
--- a/src/wx/gain_calculator_dialog.cc
+++ b/src/wx/gain_calculator_dialog.cc
@@ -52,11 +52,19 @@ GainCalculatorDialog::GainCalculatorDialog (wxWindow* parent)
float
GainCalculatorDialog::wanted_fader () const
{
+ if (_wanted->GetValue().IsEmpty()) {
+ return 0;
+ }
+
return lexical_cast<float> (wx_to_std (_wanted->GetValue ()));
}
float
GainCalculatorDialog::actual_fader () const
{
+ if (_actual->GetValue().IsEmpty()) {
+ return 0;
+ }
+
return lexical_cast<float> (wx_to_std (_actual->GetValue ()));
}