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:
@@ -593,6 +593,12 @@ void wxTextCtrl::WriteText( const wxString &text )
|
|||||||
#else
|
#else
|
||||||
wxCharBuffer buffer( wxConvUTF8.cWC2MB( wxConvLocal.cWX2WC( text ) ) );
|
wxCharBuffer buffer( wxConvUTF8.cWC2MB( wxConvLocal.cWX2WC( text ) ) );
|
||||||
#endif
|
#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) );
|
GtkTextBuffer *text_buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(m_text) );
|
||||||
|
|
||||||
// TODO: Call whatever is needed to delete the selection.
|
// TODO: Call whatever is needed to delete the selection.
|
||||||
|
@@ -593,6 +593,12 @@ void wxTextCtrl::WriteText( const wxString &text )
|
|||||||
#else
|
#else
|
||||||
wxCharBuffer buffer( wxConvUTF8.cWC2MB( wxConvLocal.cWX2WC( text ) ) );
|
wxCharBuffer buffer( wxConvUTF8.cWC2MB( wxConvLocal.cWX2WC( text ) ) );
|
||||||
#endif
|
#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) );
|
GtkTextBuffer *text_buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(m_text) );
|
||||||
|
|
||||||
// TODO: Call whatever is needed to delete the selection.
|
// TODO: Call whatever is needed to delete the selection.
|
||||||
|
Reference in New Issue
Block a user