don't crash if WriteText() argument can't be converted to UTF-8

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28442 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-07-23 21:34:19 +00:00
parent 1ce52aa64b
commit 8e033d81f2
2 changed files with 12 additions and 0 deletions

View File

@@ -593,6 +593,12 @@ void wxTextCtrl::WriteText( const wxString &text )
#else
wxCharBuffer buffer( wxConvUTF8.cWC2MB( wxConvLocal.cWX2WC( text ) ) );
#endif
if ( !buffer )
{
// what else can we do? at least don't crash...
return;
}
GtkTextBuffer *text_buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(m_text) );
// TODO: Call whatever is needed to delete the selection.

View File

@@ -593,6 +593,12 @@ void wxTextCtrl::WriteText( const wxString &text )
#else
wxCharBuffer buffer( wxConvUTF8.cWC2MB( wxConvLocal.cWX2WC( text ) ) );
#endif
if ( !buffer )
{
// what else can we do? at least don't crash...
return;
}
GtkTextBuffer *text_buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(m_text) );
// TODO: Call whatever is needed to delete the selection.