]> 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 f918d8154f189c30ed54575d9e822320103aa285..47dca6fb4d2c9687074e1e8104173c6af1bf5f97 100644 (file)
@@ -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