Check that the dialog had been created in wxTextEntryDialog

Don't crash if setter functions are called before Create() which could happen
for the default-constructed dialogs.

See #17291.
This commit is contained in:
Vadim Zeitlin
2016-01-21 22:49:42 +01:00
parent 3b98570f57
commit 0fa1ddb368

View File

@@ -152,6 +152,8 @@ void wxTextEntryDialog::OnOK(wxCommandEvent& WXUNUSED(event) )
void wxTextEntryDialog::SetMaxLength(unsigned long len)
{
wxCHECK_RET( m_textctrl, wxS("Must be created first") );
m_textctrl->SetMaxLength(len);
}
@@ -159,7 +161,10 @@ void wxTextEntryDialog::SetValue(const wxString& val)
{
m_value = val;
m_textctrl->SetValue(val);
if ( m_textctrl )
{
m_textctrl->SetValue(val);
}
}
#if wxUSE_VALIDATORS
@@ -178,6 +183,8 @@ void wxTextEntryDialog::SetTextValidator( wxTextValidatorStyle style )
void wxTextEntryDialog::SetTextValidator( const wxTextValidator& validator )
{
wxCHECK_RET( m_textctrl, wxS("Must be created first") );
m_textctrl->SetValidator( validator );
}