X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c79146df7ece620777b8e4aa9ad98a8b7be2bac7..7351db919a9dab89c951406bee859b5f3bb53f7a:/src/gtk1/textctrl.cpp diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index f918d8154f..47dca6fb4d 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -614,9 +614,8 @@ bool wxTextCtrl::Create( wxWindow *parent, wrap = GTK_WRAP_WORD_CHAR; } else -#else - wrap = GTK_WRAP_WORD; #endif + wrap = GTK_WRAP_WORD; } gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( m_text ), wrap ); @@ -908,6 +907,12 @@ void wxTextCtrl::SetValue( const wxString &value ) if (gtk_text_buffer_get_char_count(m_buffer) != 0) IgnoreNextTextUpdate(); + if ( !buffer ) + { + // what else can we do? at least don't crash... + return; + } + gtk_text_buffer_set_text( m_buffer, buffer, strlen(buffer) ); #else @@ -1003,6 +1008,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; + } + gtk_editable_insert_text( GTK_EDITABLE(m_text), buffer, strlen(buffer), &len ); #else