mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-01 08:09:41 +02:00
Bug 2458 - Possible crash when clearing text field in Gain dialog
This commit is contained in:
parent
cd38e0e76d
commit
8ae8e0f0a5
@ -322,9 +322,16 @@ bool SliderDialog::TransferDataToWindow()
|
||||
|
||||
bool SliderDialog::TransferDataFromWindow()
|
||||
{
|
||||
double value;
|
||||
// Bug #2458
|
||||
//
|
||||
// If the user clears the text control, the ToDouble below will NOT set "value"
|
||||
// since it checks the length of the incoming string and bypasses setting it if
|
||||
// it's empty. So initialize "value" for good measure and check the return value
|
||||
// of ToDouble for success before using "value".
|
||||
double value = 0.0;
|
||||
|
||||
mTextCtrl->GetValue().ToDouble(&value);
|
||||
if (mTextCtrl->GetValue().ToDouble(&value))
|
||||
{
|
||||
if (mStyle == DB_SLIDER)
|
||||
value = DB_TO_LINEAR(value);
|
||||
mSlider->Set(value);
|
||||
@ -332,6 +339,8 @@ bool SliderDialog::TransferDataFromWindow()
|
||||
mpOrigin->Set(value);
|
||||
mpOrigin->SendUpdate(value);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user