]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/textctrl.cpp
Blind fix for bug #1209944, wxFileConfig constructor corrupts the stack
[wxWidgets.git] / src / gtk1 / textctrl.cpp
index 5ec85604f15d1f50a51eac443c850fa5eb3f25cc..47dca6fb4d2c9687074e1e8104173c6af1bf5f97 100644 (file)
@@ -907,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
@@ -1002,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